One of the dominant species in the vagina of a pregnant woman, it turns out, is Lactobacillus johnsonii. It is usually found in the gut, where it produces enzymes that digest milk. It’s an odd species to find proliferating in the vagina, to say the least. Dr. Aagaard-Tillery speculates that changing conditions in the vagina encourage the bacteria to grow. During delivery, a baby will be coated by Lactobacillus johnsonii and ingest some of it. Dr. Aagaard-Tillery suggests that this inoculation prepares the infant to digest breast milk.

The baby’s microbiome continues to grow during breast-feeding. In a study of 16 lactating women published last year, Katherine M. Hunt of the University of Idaho and her colleagues reported that the women’s milk had up to 600 species of bacteria, as well as sugars called oligosaccharides that babies cannot digest. The sugars serve to nourish certain beneficial gut bacteria in the infants, the scientists said. The more the good bacteria thrive, the harder it is for harmful species to gain a foothold.

As the child grows and the microbiome becomes more ecologically complex, it also tutors the immune system. Ecological disruptions can halt this education. In March, Dr. Richard S. Blumberg of Harvard and his colleagues reported an experiment that demonstrates how important this education is.

The scientists reared mice that lacked any microbiome. In their guts and lungs, the germ-free mice developed abnormally high levels of immune cells called invariant natural killer T cells. Normally, these cells trigger a swift response from the immune system against viruses and other pathogens. In Dr. Blumberg’s microbe-free mice, however, they caused harmful inflammation. As adults, the mice were more likely to suffer from asthma and inflammatory bowel disease.

This experiment parallels studies of children in recent years. Children who take high levels of antibiotics may be at greater risk of developing allergies and asthma later on, many researchers have suggested.

Dr. Blumberg and his colleagues found that they could prevent the mice from becoming ill by giving them bacteria while they were still young. Acquiring a microbiome as an adult did not help the rodents.