I wont pretend to know the medical details. All I can say is whatever your doctor prescribes for your situation, trust them and ask your questions directly. They know your case best.
From what I know it is sometimes used to relax the uterus or slow early contractions, but it is a doctor decision entirely. I had preterm scare and they managed my medicines carefully. Please dont read and worry, just ask your gynac to explain why it is given to you.