All raw foods contain bacteria. If the food sits around the bacteria will grow and spoil it.
Some bacteria produce gas which will make a sealed can swell or even blow up
Some bacteria produce a deadly posion.
When a can is sealed no more bacteria can get in and the cook kills those on the inside.
If all bacteria are kills the canned food will keep for a long time.
Heat kills bacteria. The higher the temperature, the shorter the time. For instance, a cook of 20 minutes at 250o F. dose as good a job as 10 hours in boiling water.
Why use steam pressure retort for processing?
With steam under pressure we get a high temperature, but this must be pure steam, not steam and air.
Air is no good for carrying heat, in fact it make a good insulator. Steam from a tea kettle with a temperature of 212o F. will burn you quickly. Over air at 300o F will just feel warm