Praise be to Allah.
The basic principle regarding the obligatory prayer is that it is not permissible to interrupt it, because Allah, may He be exalted, has forbidden rendering deeds invalid.
Allah, may He be exalted, says (interpretation of the meaning):
“O you who have believed, obey Allah and obey the Messenger and do not invalidate your deeds”
Shaykh ‘Abd ar-Rahmaan as-Sa‘di (may Allah have mercy on him) said:
“and do not invalidate your deeds”. This includes a prohibition on rendering deeds invalid after doing them, by doing things that spoil them, such as reminding people of favours, self-admiration, pride and seeking a good reputation, and committing sins that spoil good deeds and cancel out the reward thereof. It also includes a prohibition on spoiling good deeds whilst doing them, by giving them up or doing something that renders them invalid.
Things that render prayer, fasting, Hajj and so on invalid are included in that and are forbidden. The fuqaha’ quote this verse as evidence for it being forbidden to interrupt an obligatory prayer ...
End quote from Tafseer as-Sa‘di (p. 789).
An exception is made for that in the case of an urgent need that cannot be deferred.
It says in al-Mawsoo‘ah al-Fiqhiyyah al-Kuwaitiyyah (34/51):
Interrupting an obligatory act of worship after starting it, with no legitimate justification for doing so, is not permissible according to the consensus of the fuqaha’, because interrupting it without any legitimate justification is foolish behaviour that is contrary to the sanctity of worship, and there is a text which forbids spoiling acts of worship. Allah, may He be exalted, says (interpretation of the meaning): “and do not invalidate your deeds” [Muhammad 47:33].
With regard to interrupting it for a legitimate, justifiable reason, that is prescribed. The prayer may be interrupted to kill a snake and the like, because it is enjoined to kill them, or for fear of losing some valuable property belonging to oneself or to someone else, or to help one who is in an emergency situation, or to alert one who is heedless or sleeping that the snake is heading towards him, and it is not possible to alert him by saying “Subhaan-Allah!”, or interrupting the fast to save one who is drowning, or out of fear for oneself or one’s nursing infant. End quote.
Undoubtedly if someone falls down during the prayer like a dead man, it may be that he has died or it may be that he is still alive and can be saved, so those who are next to him should interrupt their prayer in order to help him, because waiting until the end of the prayer may mean losing the opportunity to save him.
If it so happens that those who are around him know that he is dead, and that there is no hope of saving him, then undoubtedly that is a major incident, and leaving the dead person as he is, in the middle of the row is interrupting the row with someone who is not praying, and it may be a kind of disrespecting the sanctity of the dead person by leaving him like that.
So what appears to be the case is that it is prescribed for those who are around him to interrupt their prayer and move the dead person to the side; they should also try to cover him with whatever they can, until the people have completed their obligatory prayer and are then free to prepare him [for burial].
In this case, with regard to interrupting the prayer it is prescribed that it be limited only to what is needed, as is stated in the fiqhi principle. So if some of the worshippers exit their prayer, the shar‘i purpose mentioned above will be fulfilled by them; there is no need for all of the worshippers to interrupt their prayer and be distracted by the dead person from the obligatory prayer.
And Allah knows best.