Prostatitis is most often caused by a bacterial infection of the prostate gland. Any bacteria that can cause a urinary tract infection can cause acute bacterial prostatitis. Some sexually transmitted diseases (STDs) can cause bacterial prostatitis. These include chlamydia and gonorrhea.