When a person loses wudu (ablution) during prayer, he should immediately leave the prayer, make wudu again, and then come again to resume his prayer in the same place (if others have not closed the gap), as long as he has not spoken to anyone. The prayer of the Imam is still valid if a person praying behind him loses his wudu during the prayer.
If a person breaks his wudu during the prayer, whether praying alone or in congregation, he should immediately leave the prayer, go to renew the wudu, and then he can resume his prayer from where he left as long as he did not speak to anyone.
Sunna Files Free Newsletter - اشترك في جريدتنا المجانية
Stay updated with our latest reports, news, designs, and more by subscribing to our newsletter! Delivered straight to your inbox twice a month, our newsletter keeps you in the loop with the most important updates from our website
If he spoke to anyone, then he has to repeat the whole prayer.
This rule is according to a Prophetic hadith reported in the Sunnah of Ibn Majah and that of Ad-Darmi. It does not make any difference whether a person is in the first line or any other line, he must leave the prayer immediately after breaking the wudu. (He can walk in front of the others praying in order to leave, but he must not walk in front of the Imam).
If the Imam has to leave the prayer in this situation, he has to place someone else in his place to continue leading the prayer.