Reference: Fataawa Ramadhaan – Volume 2, Page 450, Fatwa No.377
Question: A man suffering from an uncontrollable flow of urine wanted to dry his penis and, as a result, excreted semen and this was during the day in Ramadhaan.
Response: If that which he excreted was out of desire, meaning that he tried to wipe the urine from that place and then he became aroused thus excreting the semen then his fast is nullified. This is because excreting semen with desire as a result of your own actions, whilst fasting, is from that which breaks the fast. However, if this was done without desire, then the fast is valid and the fast doesn’t have to be made up.