You can cook two things in the oven at the same time as long as they cook at the same temperature or you pay close attention. Oven temperatures are set to achieve dual objectives: heating food all the way through so it is appealing and safe, and achieving effects such as drying and crisping. Baking two dishes at the same time involves understanding the effect and the results that you want to achieve for each dish, and monitoring the baking process so that each dish receives the heat and time it needs.
Even if the two dishes that you bake together have different baking times, you can cook each one to the right temperature as long as you pay attention and pull the quicker-cooking dish out of the oven first. Opening and closing the oven to remove a dish may slightly affect the cooking time of the dish that needs to cook longer because the oven temperature will drop briefly. However, a properly functioning oven will quickly return to the desired temperature.
If you are cooking two types of bread or pastry together, choose recipes that use the same cooking temperature. Baking is a chemical process that relies on a specific input of heat and changing the degree of heat can change the result. However, cooking two casseroles that simply need to be heated through will usually work out even if their recipes call for different cooking temperatures. Watch them closely and make sure they cook fully without becoming too dry.
When cooking two dishes in the oven at the time, you risk having the flavors of the two dishes affect each other. If you are cooking two savory dishes that use similar and complementary seasonings, this will probably not be an issue. However, if you are roasting garlic and cooking an apple crisp, the garlic aroma may affect the taste of the fruit. Similarly, if you are cooking tofu for a vegan you may not want to cook it in the same oven as bacon because it may take on some of the bacon flavor.
Tinkering with Processes
If the two items that you plan to bake together cook at different rates, you can sometimes tinker with preparation processes to make them cook at similar rates. A roast takes longer to cook than a pan of vegetables, but if you cut the meat into smaller pieces before putting it in the oven, it will roast more quickly. Letting the meat you will be roasting stand before cooking until it reaches room temperature will also make it cook more quickly, closer to the cooking time of the vegetables. However, don't leave meat at room temperature longer than necessary, and check its internal temperature with a metal stem thermometer after cooking to make sure it is has reached the USDA recommended temperature for that particular type of meat.