Answered by Ustadha Shazia Ahmad
Do I have to take a bath (ghusl) if I get an erection? Also, sometimes, I get pre-sperm, and I heard I have to take a bath. Is this true or is washing the private parts enough?
The answer to both questions is no. If you get an erection or if you get pre-ejaculate fluid (madhy), you do not have to take a bath.
In the first scenario, you do not have to do anything because nothing has exited from your private parts. In the second scenario, you only have to wash it off and perform your wudu again.
This issue is further defined and clarified at the following link:
The Pre-ejaculate fluid, madhy, calls for washing and ablution before praying
And Allah knows best.