Ruling on burying the deceased in a coffin
Question

                A man died and left instructions that he be buried in a coffin. What is the ruling on that?.
Praise be to Allah.There is no dispute among the scholars that it is makrooh to bury the deceased in a coffin if 
    there is no need for that. If there is a need for that, such as if the ground is wet or there is the fear that he may be dug up by wild animals, 
    then some of the fuqaha’ say that it is permissible to bury the deceased in a coffin in that case. 
It says in Fataawa al-Lajnah al-Daa’imah 
    (2/312): 
Putting the deceased in a coffin was unknown at the time of the Messenger of Allaah  (peace 
    and blessings of Allaah be upon him) and the time of the Sahaabah (may Allaah be pleased with them), and the best for the Muslims is to follow 
    their way. Hence it is makrooh to put the deceased in a coffin, whether the ground is hard, soft or wet. If the deceased left instructions that he 
    be placed in a coffin, those instructions should not be carried out. The Shaafa’is said that it is permissible if the ground is soft or wet, but 
    according to them such instructions should not be carried out except in such cases.” 
Ibn Qudaamah said: 
It is not recommended to bury the deceased in 
    a coffin, because there is no report that the Prophet  (peace and blessings of Allaah be upon him) or his companions did that, and it also 
    involves imitating the people of this world. And the earth absorbs his remains better. 
It says in al-Insaaf: 
It is makrooh to bury the deceased in a coffin, even if the deceased is a woman. This was 
    stated by Imam Ahmad. 
Al-Sharbeeni, the Shaafa’i khateeb, said in 
    his book Mughni al-Muhtaaj: 
It is makrooh to bury the deceased in a coffin according to scholarly consensus, because it is 
    bid’ah (an innovation), unless the ground is wet or soft, in which case it is not makrooh because that serves a purpose. The deceased’s 
    instructions should not be carried out except in this case. Similarly if the deceased has been burned by fire and cannot be carried except in a 
    coffin.  
In al-Mawsoo’ah al-Fiqhiyyah it says: 
It is makrooh to bury the deceased in a 
    coffin according to scholarly consensus because it is bid’ah, and his instructions to that effect should not be carried out. But it is not makrooh 
    if that serves a purpose, such as if the deceased is burned and it is necessary to bury him in a coffin. 
And Allaah knows best.