The fundamental reason for having a refrigerator is to keep food cold. Cold temperatures help food stay fresh longer. The basic idea behind refrigeration is to slow down the activity of bacteria (which all food contains) so that it takes longer for the bacteria to spoil the food.
For example, bacteria will spoil milk in two or three hours if the milk is left out on the kitchen counter at room temperature. However, by reducing the temperature of the milk, it will stay fresh for a week or two -- the cold temperature inside the refrigerator decreases the activity of the bacteria that much. By freezing the milk you can stop the bacteria altogether, and the milk can last for months (until effects like freezer burn begin to spoil the milk in non-bacterial ways).
Refrigeration and freezing are two of the most common forms of food preservation used today. For more information on other ways to preserve food, see How Food Preservation Works.