A new study from the University of Washington links illness in pregnancy to mental health issues in children, even decades after birth.

Researchers at the University of Washington School of Medicine discovered the correlation after looking at nearly 1.8 million people born in Sweden between 1973 and 2014. It was one of the largest studies concerning the impact of infection on children's mental health that has ever been done.

People whose mothers had been hospitalized for any infection during pregnancy had a 79 percent higher risk of being diagnosed with autism and a 24 percent increased risk of being diagnosed with depression. The increased risks were apparent even when mothers had mild infections like a urinary tract infection.

"Fetal brain development is quite fragile," said Kristina Adams Waldorf, one of the lead researchers for the study. "We know that both infection and inflammation can injure parts of the fetal brain, especially parts that are really important for social and emotional control that might lead to problems that we can diagnose as autism."

Adams Waldorf said the study took two years to complete and came with some surprising outcomes.

"We were quite surprised by the association of infection in pregnancy, depression, and even suicide in children and adults that had been exposed to infection during pregnancy," said Adams Waldorf. "That was a complete surprise."

Though it's unclear how infection or inflammation impacts the fetal brain, research has shown that exposure to inflammatory proteins released by the mother's immune system may affect gene expression in fetal brain cells. Other research looks at the serotonin levels in the mother's placenta, which could also impact fetal brain development. For now, researchers have to leave some of their findings vague because they don't know exactly what's happening.

The bottom line is that the fetal brain is extremely vulnerable and researchers recommend that mothers receive vaccines like flu or a measles booster. They also recommend going to the doctor early in the first trimester.