Bukhari deals with this subject in a chapter entitled: “Those Who Prepared the Kafan in the Prophet’s Days without him objecting to it. Reporting on the authority of Sahl, Bukhari says: “A woman came to the Prophet, peace be upon him, with a woven piece of cloth that had two seams on its edges. She said: ‘I wove it with my own hands in order to wear it.’ The Prophet, peace be upon him, took it because he needed it. He wrapped it around his waist so that it covered the lower half of his body, and he came toward us. A man praised it, saying: ‘This is a very nice cloth! Why don’t you give it to me to wear?’ Some of the people present there reproached the man for they knew that the Prophet needed that cloth and that he never denied anyone’s request. The man replied: ‘By Allah, I asked him for it not to wear it, but to save it and use it as my kafan’.” Sahl continues: “And (later when he died) that same piece of cloth was used as his kafan.”
Commenting on the above chapter of Bukhari, Al-Hafiz ibn Hajar says: “Bukhari phrased it so as to show that though (initially) the companions disliked the man’s request for the cloth from the Prophet, they did not disapprove of it when he explained to them the reason for his request. This proves that it is permissible for a person to arrange during his lifetime for the things he will need after his death, such as a kafan or a grave.” He cites Ibn Battal who said it is permissible to arrange for something before it is actually needed. Furthermore Al-Hafiz observes: “Some righteous people did indeed have their graves dug and prepared for them during their lifetime.” Al-Zain ibn al-Munir criticized him, saying that the companions of the Prophet, peace be upon him, did not do so, and that if doing so (preparing one’s grave during one’s lifetime) were desirable most of them would have done so.
Commenting on this Al-‘Aini says: “The fact that it was not done by the companions of the Prophet does not imply that doing so is not permissible, for if an act is deemed good by Muslims, then it is also good in the sight of Allah, especially when it is practiced by some of the most pious scholars.”
Ahmad said: “There is nothing wrong if a person purchases a site for his burial and makes a will to the effect that he is to be buried there. ‘Uthman, ‘Aishah, and ‘Umar ibn Abd al-‘Aziz, all did so.”