Canning jars are built to be durable, but many people make the mistake of thinking that because they're glass, they're oven-proof... just like Pyrex.
They're not the same thing.
Glass expands when heated, like many materials. When it cools, it contracts. Objects that are heating or cooling usually do so unevenly due to a number of factors, including what may be touching it or even just the flow of air around it. But what many people don't know is that this causes the material stress.
To some degree, glass can handle the stress placed on it by heating and cooling, as long as it doesn't happen too rapidly and from extreme hot (such as an oven) or cold (like a freezer). Your glassware doesn't usually break when it comes out of the dishwasher and finishes cooling down in the cupboard... but it will, if you take it fresh out of the dishwasher and put it under the tap for a cold drink. Cracking from the sudden temperature change is called thermal shock.
But there are different types of glass, and different types of glass have different strengths. The different strengths come from how the glass was made and what it was made from.
Pyrex, which is oven-safe, is made of tempered glass--also known as safety glass. But even Pyrex has its limitations, and it is still vulnerable to thermal shock. If you've ever set a hot Pyrex dish on a cold surface, you may have had to duck for cover. Like all safety glass, in conditions that cause it to break, it shatters explosively into many small, blunter - mostly harmless - fragments, designed to help protect you from getting cut badly.
Mason jars are commonly made of annealed glass. When annealed glass fractures, it will shatter into irregular, very sharp pieces and miniature shards. This can cause you minor injury if you're holding it at the time, or it can crack small fragments of glass into your food. You should discard any food or drinks contained in a glass in which a crack has formed. When you use mason jars for canning, you should never pour hot food into a cool jar. If you've used a mason to store foods in the freezer, you should also be careful about defrosting them too quickly by putting them under a hot tap or in a pot of hot water.
But the reason why ovens are an exceptionally bad place to put mason jars is that the temperatures can fluctuate up and down rapidly enough to put repeated thermal stress on the jar. This can happen simply when the oven's heating element cycles itself on and off (as it does once it's reached its set temperature). Opening the oven door and removing them from the oven is another high-stress situation for the jars, as is transferring them to a rack where they can cool down. Foodsafety.gov also recommends that all foods cooked to a temperature over 90F be refrigerated within an hour, which means that you may run the risk of shattering a hot jar by transferring it to the cool environment of the fridge.
The worst risks, however, aren't simply cracking the glass.
Some recipes recommend baking it with the lid on or instructing you to close the jar shortly after removing it from the oven (such as oven-canning). In both situations, steam under pressure coupled with thermal shock can be explosive, causing burns and sending very sharp pieces of glass flying. And even worse, your risks of cultivating food borne illnesses from this method of preservation are very high.
An oven is not likely to get the center of your jar hot enough for long enough to eliminate microorganisms for long-term storage on the shelf or in the fridge. Many of these recipes are unlikely to have the correct pH balance to hinder harmful bacteria such as botulism from proliferating, and botulism can kill. If you see "oven-canning" mentioned anywhere on the recipe? Run the other way!