Hi Niamh
The steroids they gave you are to ensure that your baby's lungs are fully developed. This is usually done if there is a suspicion that your baby may be born early. (usually before 38 weeks). Your short cervix is one indication that there is a chance that your baby could come early so I would not be surprised if they offered you the injection again.

Normally there is quite a lot of moisture in your lungs but your body produces a hormone called surfactant that stops the lungs from sticking together like a wet plastic bag does. The main problem with the lungs of a baby that is born prior to 37 weeks is that there is very little production of this hormone and thus the lungs often do stick together. The injection helps with the production of this hormone and thus helps to prevent this problem