There is nothing wrong with placing the bier in front of the worshippers so that they can offer the obligatory prayer then offer the funeral prayer.
Shaykh Ibn Baaz (may Allah have mercy on him) was asked: If there is a funeral on Friday, during the prayer should we place the bier in front of us or behind us? Thank you.
He replied (may Allah have mercy on him): This matter is broad in scope. There is nothing wrong with placing it in front of the worshippers or behind, or on their right or their left. The deceased may be placed inside the mosque or near the mosque until the people have prayed, then the bier may be brought forward so that the people may offer the funeral prayer over it. It does not matter if it is placed in front of the worshippers or to their right or left, or behind them. I do not think there is anything wrong with that.
End quote from Fataawa Noor ala ad-Darb, 2/1120
Shaykh ibn Uthaymeen (may Allah have mercy on him) was asked: What is the ruling on the bier if it is placed in front of the worshippers so that they can offer the obligatory prayer and then offer the funeral prayer?
He replied: There is nothing wrong with that if we know that it will not distract them. But if we know that it will distract them then it is makrooh for one who is praying to face that which will distract him. It will not distract the worshippers if, for example, it is placed in a corner of the mosque and not in the middle of the row.
End quote from Fataawa Noor ala ad-Darb
Shaykh Sulaymaan ibn Abdullah al-Maajid (may Allah have mercy on him) said: There is nothing wrong with the people offering the obligatory prayer with the biers placed in front of them, because there is no evidence to suggest that this is not allowed. With regard to the words of the Prophet (blessings and peace of Allah be upon him), Do not pray towards graves, [narrated by Muslim from the hadeeth of Abu Marthad al-Ghanawi], this does not indicate that, because the bier is not called a grave in either linguistic, customary or shari terms. And Allah knows best.
End quote from the Shaykh's website:
Some scholars are of the view that this is not allowed because the Prophet (sa) said: Do not sit on graves and do not pray towards them. Narrated by Muslim, 972
Shaykh al-Mubaarakfoori (may Allah have mercy on him) said: Do not pray towards them means facing towards them. Al-Qaari said: By the same token, this is more applicable to the bier i.e., the bier that is placed (in front of the worshippers). This is a mistake that the people of Makkah have been doing, when they place the bier beside the Kabah then pray facing towards it.
End quote from Tuhfat al-Ahwadhi Sharh Sunan at-Tirmidhi
Shaykh al-Albaani (may Allah have mercy on him) said, commenting on the words quoted above: I say: i.e., with regard to the obligatory prayer, this is a problem that is widespread and has spread to Syria, Anatolia and elsewhere. A month ago we saw an extremely unpleasant photograph that showed a row of worshippers prostrating towards a number of biers that were placed in front of them, that contained the remains of a group of Turks who had drowned in a shipwreck. End quote from Tahdheer as-Saajid min Ittikhaadh al-Quboor Masaajid.
And Allah knows best.
Reproduced from Islam QA