Reference: Rasaa.il wa Fataawa Shaykh ‘Abdur-Razzaaq ‘Afeefee – Question 6, Page 425
Question: A man masturbates during the day in Ramadhaan, but as he is ejaculating he holds his penis [firmly] so no semen comes out from it; is he required to have a bath [or take a shower]? And is his fast correct [and unaffected by him having done this]?
Response: According to many of the Muslims, yes, he is required to have a bath [or take a shower]. If he is aroused, the semen will naturally come out, and will not remain in its place. And if [he prevents it from coming out and] the semen becomes engorged and remains in its place, then this can lead to testicular swelling, and the one who does this may require surgery or medication to treat his testicles.
If what the questioner mentioned in the question is true and actually happened, then he is required to have a bath [or take a shower], and make-up [the fast for this day]. Otherwise I think this may just be speculative [questioning], and therefore advise the Muslims to abstain from asking questions about matters which do not exist or have not happened – in accordance with the example of the companions of the Messenger of Allaah ﷺ.