When I open a jar or a bottle of...well, anything (but especially juices or sauces), I have to put leftovers in the fridge if I want to finish it later. What makes this food okay to leave on the shelf until I open it for the first time?
The canning process makes food safe: existing bacteria and fungi are killed, the intrusion of new pathogens is prevented by sealing the container. (More e.g. here.)
As soon as you open the can or jar, its contents are exposed to the surrounding air which will contain bacteria and fungal spores. Some of those will happily grow feeding on the food they land on. Refrigerating slows down their metabolism, meaning they can't reach dangerous numbers within the recommended storage time after opening. For more info on storing food, see our canonical posts on food storage and on how long quickly-spoiling food can be left at room temperature.
In addition to Stephie's safety answer, there is another reason: Many foods undergo undesirable flavor or texture changes due to reacting with the oxygen in the air (oxidation), losing or gaining moisture to the air, etc. Before you open the package, that's prevented by the air-tight seal and possibly by the air in the jar not actually being air (e.g., it could lack oxygen). Once you introduce air in to the jar (if it was originally some other gas, or vacuum) and a bunch more of it (because you made more room for air, by using some of the product), you accelerate those processes. Many of them, though, are slowed by lower temperatures—so storing in the fridge preserves quality.
Examples include ketchup, mustard, commercial mayo, and some BBQ sauces. Sometimes the jar will actually tell you this—e.g., on the back of a container of mustard "for best flavor, refrigerate after opening".
If you have a question about a particular product (e.g., because it's a sauce you want to leave out at your restaurant) probably best to contact the manufacturer.