But UK experts say that the benefits of doing this would almost certainly be heavily outweighed by the risks involved.
The team reported in the journal "Nature Medicine" that they had managed to immunise lamb foetuses against a virus.
They managed to deliver the vaccine through a fine needle into the mouth tissues of the lamb while it lay in the womb.
There are many potentially serious infections that can be passed from mother to baby. In developing countries, they are a significant cause of baby deaths shortly after birth.
Major killer
Every year, approximately five million infants worldwide die in the first week of life, most in the developing world.
The infections include HIV, herpes, hepatitis B, group B streptococcus and chlamydia.
Dr Lorne Babiuk, from the university's Veterinary Infectious Diseases Organisation, said: "No-one has immunised infants successfully yet and the sooner you can immunise them, the easier it is to close the window of susceptibility to infection."
She said: "We put a needle into the amniotic sac and then gently put it into the mouth of the lamb.
"The DNA was then taken up by the immune cells there and introduced an excellent immune response."
The lambs injected with the vaccine showed no signs of illness at birth, were of normal size and showed no abnormalities later on.
However, it is well-documented that any invasive test or treatment carried out on a human foetus carries with it a tiny risk of harm, potentially triggering miscarriage.
Chance of miscarriage
The current amniocentesis test, in which a needle is passed through the sac surrounding the foetus to sample some of the fluid there, carries with it a 1% chance of miscarriage.
An "in utero" vaccination would not only pass through the sac, but also into the foetus, with the extra risk of damaging it.
Dr Rob Feldman, the chief scientific officer of Microscience, a vaccine-producing company, said that in most cases, vaccinating the mother would make sure protective antibodies reached the baby through the placenta.
Even in the case of HIV, he said, there were ways of preventing mother to child transmission.
He said: "I can't see a major clinical application for it because of the significant risks involved, and the alternatives in the diseases we need to address."
He is currently working on a vaccine for group B Streptococcus which could be given to women before they became pregnant, or during pregnancy.
This is expected to start safety trials next year.
Group B Streptococcus affects just under one in a thousand births, and causes a severe infection which is fatal in as many as one in five cases in the UK.
There are up to 70 deaths of newborn babies a year caused by the bacterium.