Genetic and environmental are important factors.
Genetic factors may be involved, as suggested by familial inheritance of disease.
Environmental factors are thought to be very important. It is proved that allergy is more common in developed countries than developing countries and similarly more common in urban area than rural area.
In medical science it is proved that, there are cells ( called TH2 ) in our blood responsible for development a situation during childhood that will develop allergy in later life. Early childhood exposure to bacterial and viral infections and endotoxins (eg, lipopolysaccharide) can control these cells in our blood involved in allergy by suppressing them. But trends in developed countries toward smaller families with fewer children, cleaner indoor environments, and early use of vaccinations and antibiotics may deprive children of exposure to infectious agents that fail to suppress the cells related with allergy. Such trends may explain the increased prevalence of some allergic disorders in developed countries or in urban areas of developing countries. Other factors thought to contribute to allergy development include chronic allergen exposure and sensitization, diet, and environmental pollutants.
So, growing up of children in natural environment rather than a more restricted way will prevent allergy significantly.