There is some difference of opinion regarding the dead feeling pain when you give them Ghusl. The sounder opinion is they do not feel pain. However, it is obligatory to treat the dead with respect.
عَنْ عَائِشَةَ، أَنَّ رَسُولَ اللَّهِ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ قَالَ: كَسْرُ عَظْمِ الْمَيِّتِ كَكَسْرِهِ حَيًّا
(Sayidah) Aishah (May Allah Most High be pleased with her) narrated that the Messenger of Allah ﷺ said, ‘Breaking the bone of a deceased person, is like breaking it whilst he is alive.’ (Abu Dawood 3207, Sahih).
There is no doubt that we believe in the punishment of the grave and the dead feeling pain in the grave due to his own sins (see the link below for details). However, there is a difference of opinion regarding the dead feeling pain due to the mistreatment of the body after death. The Hadith above is one of the primary sources of evidence when discussing this matter.
يَعْنِي فِي الْإِثْمِ كَمَا فِي رِوَايَةٍ. قَالَ الطِّيبِيُّ: إِشَارَةٌ إِلَى أَنَّهُ لَا يُهَانُ مَيِّتًا، كَمَا لَا يُهَانُ حَيًّا. قَالَ ابْنُ الْمَلَكِ: وَإِلَى أَنَّ الْمَيِّتَ يَتَأَلَّمُ. قَالَ ابْنُ حَجَرٍ: وَمِنْ لَازَمِهِ أَنَّهُ يَسْتَلِذُّ بِمَا يَسْتَلِذُّ بِهِ الْحَيُّ اهـ. (مرقاة المفاتيح شرح مشكاة المصابيح)
It is referring to sin, as has been mentioned in (another) narration. (Imam) al-Tibi said, it alludes to the fact that the deceased should not be dishonoured, like the living should not be dishonoured. (Imam) Ibn al-Malak said, it alludes to the deceased feeling pain. (Imam) Ibn Hajr said, this dictates that he feels pleasure like the living feel pleasure. (Imam Ali al-Qari, Mirqaat al-Mafateeh).
In the Nass (text) above Imam Ali al-Qari mentions the difference of opinion regarding the meaning of the Hadith. However, even Imam Ibn Malak accepted the difference and mentioned both opinions.
هذا إشارة إلى أن الميت يتألم، أو إلى أنه لا يُهانُ ميتًا، كما لا يهان حيًّا. (شرح مصابيح السنة)
This alludes to the fact that the deceased feels pain, or to the fact that the deceased should not be dishonoured, like the living should not be dishonoured. (Imam Ibn al-Malak, Sharh Masabeeh al-Sunnah).
One of the reasons the opinion that the Hadith is referring to the sin of disrespecting the deceased, and not speaking about the dead feeling pain, is considered to be stronger is the explicit mention of sin in the narration in Ibn Maja.
عَنْ أَمِّ سَلَمَةَ، عَنِ النَّبِيِّ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ قَالَ: كَسْرُ عَظْمِ الْمَيِّتِ كَكَسْرِ عَظْمِ الْحَيِّ فِي الْإِثْمِ
(Sayidah) Umm Salamah (May Allah Most High be pleased with her) narrated that the Messenger of Allah ﷺ said, ‘Breaking the bone of a deceased person, is like breaking the bone of a living person with regards to sin.’ (Ibn Maja, 1617).
This Hadith is weaker than the narration in Abi Dawood. However, it does not contradict it. Rather it clarifies the meaning of the Hadith in Abi Dawood. It is explicit with regards to the fact that it is referring to sin. Meaning the sin of breaking the bone, and it is not saying the dead feel pain like the living. Due to this and other evidence, many Hanafi scholars preferred this opinion. Thus, they spoke about the issue being one of disrespecting the deceased not causing physical pain.
رُوِيَ عَنْ عَائِشَةَ أَنَّهَا قَالَتْ كَسْرُ عَظْمِ الْمَيِّتِ كَكَسْرِهِ وَهُوَ حَيٌّ لِيُعْلَمَ أَنَّ الْآدَمِيَّ مُحْتَرَمٌ حَيًّا وَمَيِّتًا. (بدائع الصنائع في ترتيب الشرائع)
It is narrated from (Sayidah) Aishah (May Allah Most High be pleased with her) that she said, ‘Breaking the bone of a deceased person, is like breaking it (whilst he is alive).’ Thus, it should be known that a person is to be respected dead or alive. (Imam al-Kaasaani, Badai al-Sanai).
والمعنى أن حرمة بني آدم سواء في الحالتين، فكما لا يجور كسر عظم الحي فكذلك كسر عظم الميت. (شرح سنن أبي داود)
It means that the sanctity of the children of Adam is the same in both states (life and death). Therefore, just like it is not permitted to break the bone of a living person, likewise it is not permitted to break the bone of the dead. (Imam Badr al-Deen al-Ayni, Sharh Sunan Abi Dawood).
قوله: “ككسره حيًا”؛ يعني: كما أن كسر عضو رجلٍ حيًّ فيه إثمٌ، فكذلك كسرُ عظم الميت فيه إثم؛ لأنه استخفافٌ وإذلال، ولا يجوز إذلال الإنسان لا في الحياة ولا في الممات. (المفاتيح في شرح المصابيح)
His ﷺ saying: Like breaking it whilst he is alive. Meaning, just like it is sinful to break the bone of a man whilst he is alive, likewise it is sinful to break the bone of a dead person. This is due to the fact that it necessitates disrespect and humiliation. And it is not permitted to humiliate a person in life or death. (al-Mafateeh Sharh al-Masabeeh).
And Allah Most High Knows Best.
-Answered by Shaykh Noorud-deen Rashid (26.04.2022)
Do we believe in punishment of the grave?
Is the Hadith about harming a dead person Sahih?
See also video: