I would consider things like prostatitis or epididymitis. This can be evaluated via a digital rectal exam as well as an ultrasound of the scrotum. Imaging of the prostate can be done via a transrectal ultrasound (i.e. to look for a prostatic abscess).
Tests for gonorrhea and chlamydia can be considered, as well as a urinalysis.
If infection has been ruled out, you can consider a urology or neurology referral for further evaluation.
Followup with your personal physician is essential.
This answer is not intended as and does not substitute for medical advice - the information presented is for patient education only. Please see your personal physician for further evaluation of your individual case.