All of this has been set out in detail in my book al-Tamhīd—praise be to Allah.
According to Mālik, when an imam deliberately loses his state of ablution while praying, he invalidates the prayer of all who are behind him. If, however, the loss of ablution overtakes him unintentionally, only his own prayer is invalidated. In that situation it is recommended that he appoint a deputy to complete the prayer with the congregation; if he does not, he should withdraw and they should select one of their number to lead them to completion. Should they fail to do either and instead finish the prayer individually, their prayers are still valid—save in the case of the Friday prayer. For the Friday prayer, if they split up and pray separately after the imam has withdrawn, their prayer does not count, whether his departure occurred after he had led them in one rakʿah or even before that. This is the well-known position transmitted from Mālik, and it is likewise the view of Ibn al-Qāsim.
There is, however, another opinion: if they have completed one full rakʿah of the Friday prayer with the imam, and he then loses ablution in the second rakʿah, so that they finish the prayer individually, the prayer is deemed valid for them. This is the position of Ashhab.