There is nothing wrong with burying more than one deceased person in one grave, when there is a need to do so, although that is contrary to the basic principle that each person should be buried in a separate grave.
It says in Fataawa al-Lajnah ad-Daa'imah:
The basic principle in Islam is that each deceased person should be buried in a separate grave if possible, and no one else should be buried with him, whether that is someone who died at the same time as him or someone who died after him. Similarly, the basic principle is that it is not permissible to disinter the dead after a while, remove them from their graves and put them in a single hole.
But if it is not possible (to bury each person in a separate grave) because of lack of space, and there is no other space available, or it will cause a great deal of hardship to bury each person on his own, because there are so many dead people due to epidemic, mass killing and so on, it is permissible to bury more than one dead person in a single grave.
End quote from Fataawa al-Lajnah ad-Daa'imah, 7/285
Shaykh Ibn Uthaymeen (may Allah have mercy on him) said:
What is prescribed is to bury each person in a grave on his own, as has always been the custom of the Muslims in the past and at present. But if there is a need to put two or more people together in one grave, there is nothing wrong with that, because after the battle of Uhud, the Prophet (sa) buried two or three men in each grave.
In this case, the closest to the qiblah should be the one who knew most Qur'an, because he is the best, and they should be placed next to one another. The fuqaha' said. A barrier of soil should be placed between each two.
End quote from Fataawa wa Rasaa'il al-Uthaymeen, 17/213
See also the answer to question no. 96667
The Sunnah with regard to graves is to dig a hole in the ground for the deceased, then make a niche (lahd) inside it, by digging a trench in the side of the grave nearest to the qiblah, then to place the deceased in it.
Fataawa Noor ala ad-Darb, 9/2
The scholars of the committee said:
With regard to the burial, a rectangular hole should be dug in the ground, according to the size of the deceased who is to be buried, then a niche should be made at the bottom of the grave on the side nearest to the qiblah, in which the deceased is placed with his face towards the qiblah, lying on his right side. Then the bricks should be placed level over him, and the spaces between the bricks should be filled with mud to prevent dirt getting on him, then the grave should be filled in with soil.
End quote from Fataawa al-Lajnah ad-Daa'imah, 8/384
Shaykh Ibn Baaz (may Allah have mercy on him) was asked:
In our country structures of stone and marble are built over graves, and burial chambers are built in the form of rooms beneath the ground in which the dead are placed. Is this permissible?
With regard to building over graves and erecting structures over them and plastering them, this is an evil act and is not permissible. With regard to digging a hole in the ground and placing a number of dead in it, this is contrary to the Sunnah. The Sunnah is for each deceased person to be placed in a grave on his own. A niche should be made for him and he should be placed in his grave on his own. This is the Sunnah; it is what the Prophet (blessings and peace of Allah be upon him) used to do in Madinah, and it is what the Muslims do.
But if there is a need because there are large numbers of deceased and it is too difficult to place each one in a grave on his own, then there is nothing to prevent putting two or three together in one grave.
End quote from Fataawa Noor ala ad-Darb, 14/96
To sum up the above:
Making a chamber beneath the ground and burying the deceased in it in the manner mentioned is an act that is not prescribed. What is prescribed is to bury each deceased person on his own in the manner prescribed in Islam, then to level his grave over him, and not to bury more than one person in a single grave except in cases of need and the necessity.
Further removed than that from the Sunnah and what is prescribed in Islam is: placing the dead on stones one above another in the form of shelves.
And Allah knows best.
Reproduced from Islam QA