It appears to be a problem of premature ejaculation. A condition in which the threshold for ejaculation is low. Spontaneous discharge of semen via urine or even on minor sexual arousal is very common presentation. It is a condition that needs treatment. It is unrelated to masturbation. There may not be any specific cause to it but can happen to anyone. Most importantly, with suitable medication and instructions it can be completely cured.
Next Steps
Kindly consult with a sexologist for further management and detailed instructions.
Health Tips
Don't worry. It is treatable.