Thanks for query,
infection also taken care as it may give big problem to fetus.
So we should take care of both.
Medicines should be avoided during firs trimester of pregnancy,but you are having 5 months pregnancy there is no problem taking antibiotic.
Doctor keeping in mind your pregnancy has prescribed antibiotic so nothing to worry.
Ok and bye.