Question:
If a person performs tayammum because water is unavailable and begins the prayer, and water becomes available during the prayer, what is the ruling?
Answer:
If water is unavailable, or it is not possible to use water, tayammum is prescribed. Complete purity is attained through tayammum. In this case, if he performed tayammum and began the prayer, and in the meantime water was found, he will continue the prayer. His prayer is valid by consensus.
❀ Allama al-Ghazali (may Allah have mercy on him)
says:
المتيمم إذا رأى الماء فى خلال الصلاة مضى فى الصلاة، لأن الإجماع منعقد على صحة صلاته ودوامها
If the one who has performed tayammum sees water during the prayer, he will continue the prayer, because consensus has been established that his prayer is valid and that continuing the prayer even after seeing the water is correct.