UTI While Pregnant?!

Daisy
I went to ER on Wednesday because I was having sharp pains on my right side of my pelvic area... The doctor told me I had a UTI , she prescribed me antibiotics Keflex 4 times a day for 7 days... She also mentioned that a UTI can Cause miscarriage & I'm freaking out! Anyone else went through this with ur pregnancy?