I have recently been to see specialists with regard to recurring UTIs (have had almost forty in the past two years) and, whilst going through all of the various tests that I had to have I spoke to the urologist about trying to conceive.
I was told that I needed to go on a lifelong course of antibiotics in order to keep the infections at bay but I would have to cease taking them if I was attempting to conceive.
There is another type of antibiotic you can get if you ARE trying to conceive which is okay to use if you are trying for a baby. it is a single dose that you take after sex to reduce chance of getting infection or to deal with one you already have lurking. You can speak to your doctor about that if that is what you need.
If this is just a one off infection you will be given a three day dose of antibiotic which will rid you of infection. I am unsure whether or not this is harmful when trying to conceive but, again, that is something you would have to ask doctor. I was told by Urologist that the antibiotics that are short term/one shot are not harmful when attempting to get pregnant. I do know that the three day dose does affect birth control pill though and you are advised, if not actively seeking to get pregnant, to wear a condom for seven days after taking the pills.
So, I guess, in short, there are treatments you can get that are not harmful to baby.