Exposure to pets when babies are very young could help reduce children's risk of developing allergies and obesity later in life, according to a new study.

Researchers have found that babies from families with pets are more likely to have high levels of Ruminococcus and Oscillospira – two microbes that have been associated with reduced childhood allergies and obesity – and the beneficial exposure can even be transferred to babies who are still in the womb.

In other words, even if a family were to give away their furry friend (responsibly!) prior to the infant being born, the presence of the animal in the household during the mother's pregnancy could confer microbial advantages to the unborn child's gut microbiome.

"There's definitely a critical window of time when gut immunity and microbes co-develop, and when disruptions to the process result in changes to gut immunity," says paediatric epidemiologist Anita Kozyrskyj from the University of Alberta in Canada.

Kozyrskyj's team analysed faecal samples collected from 746 infants who were part of the Canadian Healthy Infant Longitudinal Development Study (CHILD) study, which recruited expectant mothers during their pregnancies in between 2009 and 2012.

More than half of the infants in this group were exposed to at least one furry pet in the household while they were in the womb and/or after birth, with 70 percent of the pets in the study being dogs.

When the faecal samples from the exposed infants were compared with samples taken from babies who didn't live in a house with a pet at all, the levels of the beneficial Ruminococcus and Oscillospira microbes in the exposed infants were significantly higher.

"The abundance of these two bacteria were increased twofold when there was a pet in the house," says Kozyrskyj.

It's the latest evidence to suggest that exposure to small amounts of so-called friendly bacteria when children are young can actually make individuals less susceptible to developing later health problems such as asthma.

The same logic has also been hypothesised to be behind why babies born by caesarean section are more likely to be obese, with researchers thinking babies might be missing out on vaginal and gastrointestinal microbiota as a result of being delivered by C-section – although other scientists have disputed the argument.

Kozyrskyj had observed the beneficial health effects of pet ownership on babies in a previous study published in 2013, but that research only involved 24 infants.

With the team finding the same benefits now in a much larger sample, it's beginning to look a lot more certain that the mere presence of pets could be a boost to very young children's health – and not just on counts of the gut microbiome.

Pets have previously been found to benefit the social development of children with autism, reduce children's anxiety and stress, and even provide better companionship than siblings.

As for boosting babies' levels of Ruminococcus and Oscillospira without the burden (and undeniable joy) of owning a pet, Kozyrskyj says in the future scientists may be able figure out how to deliver the microbial benefits that furry animals naturally provide by virtue of being, well… dirty – not that that makes us love them any less.

What this means is that the concept of a 'dog in a pill' treatment of some kind to help prevent allergies and obesity might just be around the corner.

"It's not far-fetched that the pharmaceutical industry will try to create a supplement of these microbiomes," says Kozyrskyj, "much like was done with probiotics."

The findings have been reported in Microbiome.