Refrigerators cool by pulling in air from inside the food compartment, and blowing it across a series of copper coils filled with refrigerant. This reduces the temperature of the air. The refrigerant absorbs the heat in the air and is pumped down to coils on the bottom of the refrigerator, where the heat is discharged.
As air is blown across the cold copper coils, humidity in the air condenses on the metal. This is because the coils are below the dew point of the air. Dew point refers to the temperature at which humidity in the air will condense on a surface, and is responsible for water vapor condensing on a mirror when you breathe on it. As water vapor condenses on the coils, it drips down in to a drain, which removes the water to the bottom of the refrigerator, where it collects in a condensate pan.
If the air that was being blown in to the refrigerator was not dehumidified, water vapor would condense on the walls and ceiling of food compartment. Over time, this would lead to mold and mildew growth, as well as contributing to food spoilage. One can quickly see the effect of humidity on the inside of a refrigerator if they have ever left the door closed on an unplugged unit. The cool, damp, and dark space quickly provides a home to all sorts of bacteria and fungi.
Condensation in the freezer compartment of a refrigerator is what necessitated older units being defrosted from time to time. The water vapor in the air would condense on the walls and shelves of the freezer, quickly turning to ice. Over time, this ice buildup would reduce the efficiency of the freezer and needs to be removed through defrosting.