This is often caused by trauma to the testicles, but can be due to other conditions, including infections(such as infection of the prostate Certain dietary habits can also cause discolored semen. Rarely, brown semen is indicative of a more significant issue, like testicular cancer
- Prostatitis This is caused by inflammation of the prostrate gland. It would be painful and be accompanied by these other symptoms - pain when urinating, pain when ejaculating, difficulty urinating and discomfort around the pelvis, bottom, lower genitals and lower back. It is caused mostly by a bacteria infection, which can be treated by a doctor by antibiotics.
Epididymitis This is caused by a bacterial inflammation. The main and most common bacteria causing this is E. Coli. This bacteria can come from two things-
A) The urinary tract back-flowing into the reproductive tract.
B) Not cleaning the penis properly after anal sex (The anus is the perfect breeding ground for E.Coli bacteria). It can also be caused by the chlamydia and gonorrhoea sexually transmitted diseases.
As for treatment you'll have to see a doctor, because it depends which is causing the issue for the patient.
-Cancer Prostrate or testes cancer can cause a bleed, which can leak into sperm. Get checked right away. The faster you get checked, the better, because cancer, if that is the cause, spreads every day
- Sexually Transmitted Disease If left untreated for a long period, chlamydia and gonorrhoea will eventually cause blood to be leaked into the genitals and therefore the sperm. Herpes can cause internal ulcers almost immediately, which can bleed, causing blood to leak into the sperm. Either way, you need to see a doctor as soon as possible.
The cause could be minor or it could be major - only way to be sure id to get it seen to. Avoid having sexual intercourse. Blood is very infectious, many conditions in blood can be passed on to others through contamination.
You should contact your doctor.