The trial, being led in Edinburgh, involves 400 pregnant women and aims to find a way to tackle a “vicious cycle” of obesity.
Obese women are more likely to have overweight babies, which have a greater chance of going on to become obese later in life.
A daily dose of metformin, a pill usually used to treat diabetes, will be given to half the women, with the remainder taking a placebo.
The University of Edinburgh scientist leading the research said if the trial is successful the treatment could be widespread within five years.
A total of 16 per cent of pregnant women in Scotland are obese. A big baby, over about 10lb, is around twice as likely to grow into an overweight adult.
Trial leader Professor Jane Norman, maternal and fetal health expert at the University of Edinburgh, told The Scotsman the aim was to cut the “vicious cycle” of obesity.
“Obesity is a really important problem in Scotland because our rates are higher than anywhere else in the Western world apart from the US,” she said.
“One of the ways we can tackle this is by intervening in the early stages of life in utero, to try to programme the baby to grow up lean instead of obese.”
She defended the research against claims that medicating babies in the womb is controversial, when methods such as exercising and changing diet to tackle the problem could be used instead.
“I don’t think trying to improve the health of pregnant women and their babies is controversial. I think it sounds very sensible.
“I think some people still don’t fully understand the risk that obese pregnant women are running. Not to try and do something about this would seem controversial to me.”
To qualify, women must have a body mass index of 30 or above, at which point they are considered obese.
It is hoped 200 women will take part from Edinburgh, with the rest coming from Coventry, Liverpool and Sheffield. So far 95 are taking part in the study, funded by the Medical Research Council and the National Institute for Health Research.
As well as having a higher likelihood of an overweight child, obese women are at higher risk of dying in pregnancy, having Caesarean sections and suffering conditions including pre-eclampsia. They are also five times more likely to have a stillborn baby.
It is hoped that the daily dose of metformin will benefit the pregnant woman as well as her child, by reducing these risks.
The birth weight, thickness of a skin fold and fat density of babies taking part in the study will be measured and researchers hope to do follow-up tests on the children at the ages of two and five. Metformin has been used to treat diabetes for decades and is cleared for the treatment of diabetes in pregnancy.