All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallahu ‘alayhi wa sallam, is His slave and Messenger.
First of all, it should be noted that the settlement of the debts for which the deceased is liable is given precedence over the right of the heirs to the deceased's estate regardless of whether those debts are owed to Allah or to people. These debts must be repaid first before dividing the estate among the heirs. Scholars held different opinions regarding which debt should be given priority in settlement if the estate is not large enough to settle both the debt owed to Allah and that owed to people.
Some scholars held that the rights of people should be given precedence over the rights of Allah because the rights owed to Allah may be forgiven by Him, whereas the rights owed to people are different; rather, people are keen on having their rights fulfilled; or because Allah is in no need, whereas people are needy. Some scholars held that fulfilling the rights owed to Allah takes precedence over fulfilling the rights owed to people if the estate is not large enough to fulfill both. They used the statement of the Prophet, sallallahu ‘alayhi wa sallam, “The debt owed to Allah is more deserving of being paid off.” as evidence. He also said, “Fulfill the right of Allah, for He is more deserving that His rights should be fulfilled.”
The debts owed to people are a serious issue, and the basic principle is that they must be fulfilled (unless they are pardoned). The Sunnah instructs that if a person passes away while in debt, his soul is suspended until the debts are paid off. The Prophet, sallallahu ‘alayhi wa sallam, said, “The soul of the believer is suspended by his debt until it is settled for him.” [Ahmad and At-Tirmithi - At-Tirmithi graded it hasan (good)]
The author of Tuhfat Al-Ahwathi said, “i.e., it (the soul of the believer) is detained and kept from reaching its noble destination. Al-‘Iraaqi said, ‘i.e., no judgment is passed as to whether it will be saved or doomed until it is determined whether his debt will be paid off or not.’”
He may be punished in his grave as well until his debts are paid off. Jaabir, may Allah be pleased with him, said:
“A man died and we washed and shrouded him. Then we brought him to the Messenger of Allah, sallallahu ‘alayhi wa sallam, to lead the funeral prayer for him. He, sallallahu ‘alayhi wa sallam, took a step forward and then asked, ‘Does he have any outstanding debts?’ We answered, ‘Two dinars.’ (He, sallallahu ‘alayhi wa sallam, started to leave.) Abu Qataadah, may Allah be pleased with him, took responsibility for paying them, saying, ‘The two dinars are my responsibility.’ When Abu Qataadah paid off the debt one or two days later, the Messenger of Allah, sallallahu ‘alayhi wa sallam, said, ‘Now you have made his skin cool down.’” [Ahmad, Al-Haakim, and others]
Ash-Shawkaani wrote, “The statement, ‘Now you have made his skin cool down,’ is evidence that the deceased becomes absolved of the debt and is no longer tormented because of it once the debt is actually paid off on his behalf, not merely when it is declared that someone will repay it on his behalf. This is why the Prophet, sallallahu ‘alayhi wa sallam, asked Abu Qataadah the following day whether he had repaid it or not...” [Nayl Al-Awtaar]
Al-Albaani commented on the hadeeth, “‘Now you have made his skin cool down;’ this is because he is relieved of the punishment once his debt is repaid.” [Ahkaam Al-Janaa'iz]
Allah knows best.