I'm on it every day for life due to kidney disease and have been taking it every day of my pregnancy. I'm now 27 + 5. Docs assured me it was absolutely fine and so far so good. So I'm sure a course to treat an infection is more than fine.
I also take this every day to prevent urine infections. Was on loads of meds when I fell pregnant and it's the only one I've been able to stay on. Dr said they regularly use it in pregnancy and it's absolutely fine xx