Benefit > risk
Physicians, especially those treating pregnant women, weigh risks and benefits of drugs for both the woman and her baby.
can have some risks such as increased bs, susceptibility to infection. Giving them too often might pose some problems for newborns also. However, most studies show that they have benefits for babies at risk of being born premature, and that is why they're given for some.