There are a number of reasons for unintended penis discharge.
Wet dreams (nocturnal emissions) are a normal occasional event during deep sleep for all men, and are due to a spontaneous ejaculation of semen. They may be distressing to boys going through puberty who do not understand the phenomenon. Their frequency decreases with age.
Sexually transmitted bacterial infections of the urethra (urine tube) are the most common cause of penile discharges. Examples include gonorrhoea, chlamydia and non-specific urethritis. Appropriate treatment is essential to prevent further spread and complications such as infertility.
Prostatitis is a bacterial infection of the prostate gland at the base of the penis. Symptoms include difficulty in passing urine, pelvic and penis discomfort and pain, a discharge from the penis and sometimes a fever. It often persists for months and requires lengthy treatment with antibiotics to be cured. The infection may be sexually transmitted.