Before refrigeration was common, people evened out the ebbs and floods of harvests by preserving excess for later use. One of the ways that food was preserved was through canning. While most food can only be canned safely under high temperature and high pressure conditions that will require a pressure canner, acidic foods (pH less than 4.6) can be preserved in jars by using a boiling water bath.
The basic principle of canning is to kill all the microorganisms that spoil food, then to seal the jar tight to keep them out. That's why canning places such emphasis on sterilization, cleanliness and hygiene.