You don't necessarily have to avoid sex if you have prostatitis — an infection or inflammation of the prostate gland. Typically, sex won't worsen prostatitis, but it won't make it better, either.
While it's OK for most men with prostatitis to have sex, some men have pain during or after orgasm (ejaculation). This can interfere with the enjoyment of sex.
Prostatitis is frequently caused by bacterial infections, but it's usually not caused by something that can be passed on to your partner during sex. In rare cases, prostatitis is caused by a sexually transmitted infection (STI). Don't have sex until you see your doctor if you have any signs of an STI, such as sores on your genitals or abnormal discharge from your penis.
To relieve prostatitis pain, try soaking in a warm bath. Over-the-counter pain relievers, such as aspirin or ibuprofen (Advil, Motrin IB, others), also may help, unless your doctor has told you to avoid these medications. You may need prescription medication to treat the underlying cause of your prostatitis.
Prostatitis — and other conditions with similar symptoms — have a number of possible causes. Some of them can have serious consequences if they aren't treated. If you have pelvic pain, difficult or painful urination, or painful ejaculation, see your doctor.