Sayyiduna Jabir bin Abdullah (may Allah be pleased with them both) said that the Messenger of Allah (peace and blessings be upon him) would not lead the funeral prayer over a man who was in debt. A deceased person was brought, and he (peace and blessings be upon him) asked: "Is he in debt?" They said: Yes, two dinars. He (peace and blessings be upon him) said: "Offer the funeral prayer over your brother." Sayyiduna Abu Qatadah (may Allah be pleased with him) said: I take responsibility for them. Then he (peace and blessings be upon him) led the prayer over him. Later, when Allah Almighty granted conquests, the Messenger of Allah (peace and blessings be upon him) said: "I am closer to every believer than his own self. Whoever dies in debt, his debt is upon me, and whoever leaves wealth, it is for his heirs."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحوالة / 11397