Praise be to Allah.
If the deceased has any money then the expenses of preparing him for burial should be paid from his own money. This takes precedence over paying off his debts and executing his will if he left a will, and it comes before the division of the estate. The evidence for that is the words of the Prophet (peace and blessings of Allaah be upon him) concerning a man who died in ‘Arafah: “Shroud him in his two garments.” Narrated by al-Bukhaari, 1851; Muslim, 1206.
Ibn al-Qayyim said in Zaad al-Ma’aad, 2/240 concerning the rulings that are derived from this hadeeth:
The shroud takes precedence over the rights of the heirs and payment of debts, because the Messenger of Allaah (peace and blessings of Allaah be upon him) ordered that he be buried in his two garments, and he did not ask about his heirs or any debts that he owed. If it had been otherwise he would have asked.
Just as clothing him when he is alive takes precedence over paying off his debts, the same applies after death. This is the view of the majority, and there is a differing opinion to which no attention need be paid. End quote.
See: al-Majmoo’, 5/147; al-Mughni, 3/457
Al-Kasaani said in Badaa’i’ al-Sanaa’i’ (2/330): He should be shrouded from his entire wealth, before paying off debts, executing his will or dividing the estate, because this is one of the basic needs of the deceased. So it is like spending on him when he is alive. End quote.
If the deceased does not have any wealth then shrouding him or her is the duty of the one who is obliged to spend on him or her (such as the father, son or husband). If there is no such person then it must be done by the bayt al-maal. If there is no bayt al-maal then it must be done by the Muslims.
See: al-Majmoo’, 5/148-150; Badaa’i’ al-Sanaa’i’, 2/330
Shaykh Ibn ‘Uthaymeen said in al-Sharh al-Mumti’, 5/219: The bayt al-maal of the Muslims is mentioned before the Muslims in general because the bayt al-maal is for all Muslims, unlike the case if it is done by the Muslims, because the one who donates it will feel that he has done him a favour. End quote.
He also said (5/217): But if we assume that there is an organization that is responsible for that, there is nothing wrong if we shroud him from that, unless he issued instructions to the contrary, such as saying, Shroud me from my own wealth, in which case it is not permissible to shroud him using the public shrouds, whether that is done by a government organization or a private one. End quote.
Because the husband is obliged to spend on his wife when she is alive, shrouding her is obligatory for him.
This is the view of Abu Haneefah, al-Shaafa’i and Maalik. Ahmad said: It must be paid for from her wealth.
See: al-Majmoo’, 5/148-150; Haashiyat Ibn ‘Aabideen, 3/101
Shaykh Ibn ‘Uthaymeen said in al-Sharh al-Mumti’ (5/219), commenting on the view of the majority: This view is more correct if he is well off.
Shaykh ‘Abd al-Rahmaan al-Sa’di (may Allaah have mercy on him) was asked: Is a husband obliged to shroud his wife? He replied:
The correct view is that the husband is obliged to shroud his wife, whether she was well off or not. This is part of spending and kind treatment, and the people regard it as wrong if it is suggested that if the wife of a man who is rich and well off dies, he does not have to shroud her. End quote.
Al-Faatawa al-Jaami’ah li’l-Mar’ah al-Muslimah, 2/242
But a wife is not obliged to shroud her husband, because she is not obliged to spend on him when he is alive.
Al-Kasaani said in Badaa’i’ al-Sanaa’i’ (2/330): The wife is not obliged to shroud her husband, according to consensus, just as she is not obliged to clothe him when he is alive. End quote.