All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Ghusl (ritual bath) or ablution are not compulsory for fasting; rather, the fast is valid without them. For example, if a person has sexual intercourse with his wife and sleeps without performing Ghusl until the Aathaan of Fajr is called, and then he gets up and performs Ghusl, then his fasting is valid as it is confirmed that the Prophet used to do that.
Allaah knows best.