I had a bladder infection around 20 weeks. It was causing me to have contractions, so I did take the antibiotic that my OB recommended. (I don't remember what it was.) My husband's cousin had chronic infections during her two pregnancies, and she's sure that they contributed to her early deliveries.
Just remember that your OB is a medical professional and wouldn't give you something that would harm you or your baby. You'll be ok.