Treatment of prostate infections can be complicated, due to the limited options of antibiotics with adequate drug concentrations into the prostate. Prostate procedures may lead to an increased risk of infections, such as prostatitis and bacteremia. It is for this reason that surgical prophylaxis is recommended prior to prostate procedures. The American Urological Association has provided guidelines regarding this matter.
In review, only a one time dose of antibiotics is needed at least 1 hour prior to the procedure. Antibiotics with good penetration into the prostate are preferred such as trimethoprim-sulfamethoxazole and fluoroquinolones. There data suggesting that rectal screening can be used to help guide these antibiotics although the data is limited.
https://www.auanet.org/guidelines/archived-documents/antimicrobial-prophylaxis-best-practice-statement