They are to protect the plants from insects, animals, or fungi that might damage or eat them. The hairs act as a physical barrier, a deterrent, or a trap for the pests.
The hairs also create a layer of air around the leaf surface, which reduces the temperature and the water vapor pressure gradient.
Some plants have shiny or reflective hair that helps to reflect excess sunlight or ultraviolet radiation, especially in hot or high-altitude environments. The hairs can scatter or absorb the light and prevent the leaf from overheating or burning.
On other plants it can help to collect water or nutrients from the air, especially in humid or nutrient-poor environments. The hairs capture water droplets, dust particles, or pollen grains and transport them to the leaf surface or the roots.