Abu Saied al-Khudri says that a dead body was brought to the Prophet for funeral service. The Holy Prophet ﷺ asked if the deceased was indebted and on getting an affirmative reply he asked if he had left any property from which the debt could be cleared and was told that he had not. The Prophet then asked others to say the prayer (saying he would not do it). Ali, on realising the situation, came forward and said that he would take the responsibility of paying the dead man’s debt, whereupon the Prophet advanced and conducted the funeral service and said (as another report says), “O Ali, may God save you from fire and grant you forgiveness as you relieved your Muslim brother. Any Muslim who pays the debt of another Muslim is assured of indulgence on the Day of Reckoning.”
The hadīth underlines the importance of clearing the debt. If even a man who has sacrificed his life in the way of God, departs without paying his debt, will not be forgiven as it concerns the rights of fellow beings. Unless the creditor forgives him, God will not. If anyone died and had a mind to repay the debt but could not, then on the Day of Judgement God will call the creditor and ask him to forgo and give him the boons of Paradise instead and then the creditor will forgo. But if despite being in a position to pay, did not pay or got the creditor to forgo his claim then he cannot be forgiven.