The Prophet ﷺ used to refuse to pray over a man who had outstanding debts. A deceased person was brought to him, and he asked, "Does he have any debt?"They said, "Yes, he owes two dinars."He said, "Pray over your companion."Abu Qatada said, "They are upon me, Messenger of Allah."So he prayed over him. Later, when Allah granted victories to His Messenger ﷺ, he said, "I am closer to every believer than his own self. Whoever leaves behind a debt, it is upon me to settle, and whoever leaves behind wealth, it belongs to his heirs."
أخبرنا نوح بن حبيب القومسي قال حدثنا عبد الرزاق قال أنبأنا معمر عن الزهري عن أبي سلمة
كان النبي ﷺ لا يصلي على رجل عليه دين فأتي بميت فسأل أعليه دين قالوا نعم عليه ديناران قال صلوا على صاحبكم قال أبو قتادة هما علي يا رسول الله فصلى عليه فلما فتح الله على رسوله ﷺ قال أنا أولى بكل مؤمن من نفسه من ترك دينا فعلي ومن ترك مالا فلورثته
[Sahih] Reported by Abu Dawud, Buyu, chapter titled "On being strict regarding debt," no. 3343, through the hadith of Abdul-Razzaq, and it appears in his Musannaf, no. 15257, and in the Kubra, no. 2089. Ibn Hibban graded it sahih, no. 1162, as did Ibn Jarud, no. 1111. It has corroborating narrations in Ahmad, 3/330, and in Muslim and others.