It is narrated from Sayyiduna Abu Qatadah (may Allah be pleased with him) that a funeral was brought to the Messenger of Allah (peace and blessings be upon him) so that he might offer the funeral prayer over it. The Prophet (peace and blessings be upon him) said: "Offer the prayer over your companion yourselves, for he has a debt upon him." Sayyiduna Abu Qatadah (may Allah be pleased with him) said: That debt, O Messenger of Allah, is upon me (i.e., I will pay it). He said: "Will you pay it in full?" He replied: I will pay it in full. Then the Prophet (peace and blessings be upon him) offered the funeral prayer over him.
It is understood from this that debt is a very grave affliction, for the Messenger of Allah (sallallahu alayhi wa sallam) hesitated to perform the funeral prayer because of it, even though he (sallallahu alayhi wa sallam) was extremely compassionate and well-wishing towards his companions.
Some scholars have said: The Messenger of Allah (sallallahu alayhi wa sallam) did this as a warning, so that others would be very mindful about repaying debts. And this debt is such a calamity that even though all the sins of martyrs will be forgiven, the debt will not be forgiven, because it is among the rights of the servants (huquq al-‘ibad).
The scholars have said: From this hadith it is derived that it is permissible for the imam to refrain from performing the funeral prayer over some men who have committed a sin, in order to instill fear in others, but the rest of the people may perform the prayer, just as the Messenger of Allah (sallallahu alayhi wa sallam) commanded: “You all perform the prayer over him.”
It is also established from this hadith that it is valid to guarantee (take responsibility for) the deceased’s debt, and that paying off the debt on his behalf is a great act of reward.