The Hygiene Hypothesis
The hygiene hypothesis (HH) suggests that a lack of exposure to infections, parasites and symbiotic microorganisms (gut bacteria) particularly in early life predisposes one to allergies and autoimmune disease. There are a number of observations that support the hygiene hypothesis
- In western countries rates of infectious disease have decreased while rates of allergies and autoimmune disease have increased 
- Countries with high rates of infectious disease tend to have low rates of allergic and autoimmune disease 
- People who live in rural areas are less likely to get asthma, autoimmune disease, allergies 
- Most people were infected with the hepatitis A virus before 1975 and has declined rapidly 
- Some parasitic worms (whipworm, hookworm) improve or prevent autoimmune disease 
The original proposed mechanism was that infants have more T helper 2 cells (Th2), which is the part of the immune system associated with allergies, and that bacterial and viral infections are needed to promote a T helper 1 cell (Th1) response. However, there are many problems with the mechanism  and also rates of autoimmune disease have increased alongside of allergies, and autoimmune diseases are associated with the Th1 cells 
Another proposed mechanism is that we need infections/parasites to keep our immune system busy and if it’s no longer challenged it will attack innocent bystanders (self-antigens). A counter to this is that Human populations have historically been too small to sustain endemic infections (such as influenza, measles, mumps, smallpox) and therefore it’s unlikely that we need them, also common childhood infections don’t protect against allergy 
A more likely explanation is that parasites (such as whipworm and hookworm) and some viruses (such as hepatitis A virus) suppress the immune system to improve their survival   . Parasitic worms need to be tolerated because clearing them would result in a lot of tissue damage, and so the host deliberately suppresses the immune system once infected with them 
Infections and Autoimmune Disease
Infections aren’t always helpful in regards to autoimmune disease or other immune related diseases. Some infections seem to trigger autoimmune diseases and most will tend to accelerate them due to increased immune activity and inflammation . Some infections promote eczema and animal models of eczema are symptom-free under specific pathogen-free conditions 
In T1D the infection is probably enteroviruses (especially coxsackievirus B). Enteroviruses preferentially infect the thymus and pancreatic β-cells and trigger an inflammatory response. T1Ds tend to have enteroviruses and their components in the pancreas and enterovirus RNA and anti-enterovirus antibodies in serum. Exposure to enteroviruses in early life and of the mothers during gestation increases the risk of developing T1D and the peak in enterovirus infections tends to occur before the peak in onset of T1D 
Many other viral* and bacterial** infections are associated with autoimmune diseases. The diversity of antigens from infections may help explain why there are so many different autoimmune diseases.
* EBV with multiple sclerosis  and lupus , HSV with stromal keratitis (herpetic keratoconjunctivitis) , hepatitis C with myasthenia gravis, autoimmune hepatitis, cryoglobulinemic vasculitis, and rheumatoid diseases, coxsackievirus strains B3 and B4 with autoimmune myocarditis and Sjorgen’s syndrome,, HSV-1 with autoimmune keratitis and rotavirus, coxsackie B viruses and rubella virus with T1D 
** H. pylori with autoimmune gastritis, A Streptococcus with rheumatic heart disease, S. pyogenes induces rheumatic fever through molecular mimicry, N. aromaticivorans with primary biliary cirrhosis, B. burgdorferi with many different autoimmune diseases, T. cruzi with Chagas’ cardiomyopathy and a helminth worm (schistosomas) is thought to promote autoimmunity 
Molecular Mimicry and the Bystander Effect
Infections can induce autoimmune disease by either the process of molecular mimicry or the bystander effect .
Molecular mimicry is where the immune system develops antibodies to a particular amino acid sequence expressed by a pathogen, which happens to be structurally similar enough for the antibodies to cross react with self-antigens, our own tissues.
The bystander effect is where an infection leads to inflammation and tissue damage. Then the infected and damaged tissue is considered foreign by the immune system and antibodies are made against it, but these antibodies are cross-reactive with nearby undamaged tissue.
Molecular mimicry and the bystander effect are observed in animal models of autoimmune disease . But these mechanisms are incomplete for two reasons: (1) why does the immune system continue to attack the body after the pathogen has been destroyed; and (2) why has the incidence of autoimmune disease increased while infectious disease has decreased?