Sheikh M. S. Al-Munajjid, a prominent Saudi Muslim lecturer and author, stated in this regard:
“People will be gathered on the Day of Resurrection barefoot, naked and uncircumcised. It was narrated from Ibn ‘Abbas (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: “You will be gathered barefoot, naked and uncircumcised.” Then he recited, “As We began the first creation, We shall repeat it. (It is) a promise binding upon Us. Truly, We shall do it” (Al-Anbiya’ 21:104). Then he said: “The first one to be clothed on the Day of Resurrection will be Ibrahim. Some people from among my followers will be taken away towards the left and I will say, ‘My followers, my followers!’ He will say, ‘They kept turning back on their heels after you left them.’ And I will say what the righteous slave said:
‘And I was a witness over them while I dwelt amongst them, but when You took me up, You were the Watcher over them; and You are a Witness to all things. (This is a great admonition and warning to the Christians of the whole world).
If You punish them, they are Your slaves, and if You forgive them, verily, You, only You, are the All-Mighty, the All-Wise’ (Al-Ma’idah 5:117].” (Reported by Al-Bukhari, 3349)
It was narrated that ‘Aa’ishah (may Allah be pleased with her) said: “The Messenger of Allah (peace and blessings be upon him) said: ‘You will be gathered barefoot, naked and uncircumcised.’ I said, ‘O Messenger of Allah, men and women will be looking at one another?!’ He said, ‘The situation will be so terrible that that will not concern them.’” (Reported by al-Bukhari, 6527)
And it was narrated in the hadith that people will be resurrected in the clothes in which they died. It was narrated that when Abu Sa`id Al-Khudri was dying, he called for new clothes and put them on, then he said, “I heard the Messenger of Allah (peace and blessings be upon him) say, ‘The deceased will be resurrected in the clothes in which he died.’” (Reported by Abu Dawud, 3114; classified as sahih by Al-Albani in As-Silsilah As-Sahihah, 1671).
This hadith may seem to contradict the hadith quoted above, which says that they will be resurrected naked. The scholars reconciled between the two reports by noting the following points:
1- That they will be raised in those garments but they will wear out after the resurrection, and when they reach the place of standing they will be naked.
2- They will be raised naked then when the Prophets and righteous people, etc., have been clothed, everyone else will be clothed in the same kind of clothes as those in which they died.
3- Some of the scholars interpreted this hadith as referring to the martyrs (shuhada’), because they are the ones whom the Prophet (peace and blessings be upon him) commanded should be buried in the clothes in which they died, so they will be resurrected in their clothes in order to distinguish them from others.
4- What is meant by clothes is righteous deeds, as in the verses “and the raiment of righteousness, that is better” (Al-A`raf 7:26)
“And purify your garments”(Al-Muddaththir 74:4)
What is meant by a person being resurrected according to what he was doing when he died is that if his final action was good, then it will be good (for him) and if it was bad then it will be bad (for him). This is indicated by the hadith of Jabir who said: “I heard the Prophet (peace and blessings be upon him) say, ‘Every person will be resurrected in the manner that he died.’” (Reported by Muslim, 2878)
And Ibn ‘Umar (may Allah be pleased with him): “The Messenger of Allah (peace and blessings be upon him) said: ‘When Allah sends down punishment upon a people, the punishment also befalls those who were among them, then they will be resurrected according to their deeds.’” (Reported by Al-Bukhari, 7108).
This is also indicated by the hadith of Ibn ‘Abbas (may Allah be pleased with him) who said: “Whilst a man was at ‘Arafah, he fell from his mount and broke his neck (or it broke his neck). The Prophet (peace and blessings be upon him) said, ‘Wash him with water and lotus leaves, and shroud him in two garments, but do not apply perfume or cover his head, for he will be raised on the Day of Resurrection reciting the Talbiyah.’” (Reported by Al-Bukhari, 1265).
Hence it is mustahabb (recommendable) to encourage one who is dying to say Laa ilaaha ill-Allaah, so that these good words will be his last words in this world and he will be raised saying them on the Day of Resurrection. See Fath Al-Bari, 11/383.”