Steroids given to help premature babies develop may also be slightly increasing the risk of mental health disorders, say researchers.
The drugs are often given to pregnant mothers at risk of a premature birth to help the baby's lungs prepare for life outside the womb.
The study, in the journal PLoS One, showed there was a higher risk of attention disorders at age eight.
The charity Bliss said it reinforced the need for regular health checks.
Being born too soon can lead to long-term health problems and the earlier the birth the greater the problems.
One immediate issue is the baby's lungs being unprepared to breathe air. Steroids can help accelerate lung development.
However, the study by researchers at Imperial College London and the University of Oulu in Finland showed the drugs may also be affecting the developing brain.
'Most children not affected'
They compared what happened to 37 premature children whose mother was injected with steroids with 185 premature children, of the same weight and gestational age, who were not exposed to the extra dose of steroid.
When the children were followed to the age of eight, there was a higher incidence of attention deficit hyperactivity disorder. No difference could be detected at age 16, but this may have been due to the small size of the study.
Prof Vivette Glover, of Imperial College, told the BBC: "There is an increase in risk, but most children are not affected.
"These are really important and lifesaving drugs. These findings shouldn't affect clinical practice and parents shouldn't worry."
She said the findings backed up previous research on stress, anxiety and depression in pregnancy affecting the child.
Those conditions increase levels of cortisol and may be having a similar effect on the developing brain as glucocorticoid steroids had in this study.
Prof Glover said womb environment could have "huge and very important long-term effects".
Andy Cole, the chief executive of the baby care charity Bliss, said: "Steroid treatments are extremely important to the development of many preterm baby's lungs and are proven to save lives.
"This study reinforces the need for the very best care to be given to all preterm babies and the importance of thorough follow-up and developmental checks.
"While the study indicates a very slight increase in the risk of ADHD in the short term, as the study states no long-term difference between those babies whose mothers did and didn't receive steroid injections we would not suggest this is a cause for concern."