Researchers say that the drugs, particularly if taken for lengthy periods, may alter gut microbes associated with weight gain.
The composition of gut bacteria (the microbiome) has been linked to various aspects of human health, including obesity.
The study examined antibiotic and antacid prescriptions for 333,353 children in their first two years and followed their medical records up to the age of eight.
But of the 47,000 who went on to become obese, almost 90 per cent had been prescribed either antibiotics or antacids.
The survey showed there was a particular risk for boys and for children born by caesarean section, who are believed to miss out on important gut bacteria transferred through the birth canal.
The researchers found that 72.4, 11.8, and 3.3 percent of children were prescribed an antibiotic, an H2RA, and a PPI, respectively.
Acid suppressants were also associated with a heightened obesity risk, although to a lesser extent, and this association strengthened for each 30-day supply prescribed.
The study, led by Christopher M Stark, Apryl Susi, Jill Emerick and Cade M Nylund, reports that acid suppressants and antibiotics taken in early childhood can modify gut microbiota, especially if they are taken for prolonged periods, and may, in turn, increase the likelihood of developing obesity.
But the researchers also pointed out that over prescription of both antibiotics and acid suppressants, including in young children, is "a significant problem".
Dr Max Davie, officer at the Royal College of Paediatrics and Child Health, said: "Childhood obesity levels in the United Kingdom are at crisis point with one in three children overweight or obese by the time they leave primary school. In the meantime, children who are obese must receive tailored support to help them return to a healthy weight - we therefore call on the Government to ensure specialist obesity services are appropriately funded to prevent obese children today becoming obese adults in future".
Davie did stress the study has its limitations, being observational and not taking into.