We advise these people to fear Allaah, may He be glorified and exalted, and to pray in congregation with the Muslims in the mosques, for the most correct scholarly view on these matters is that prayer in congregation must be offered in the mosques, and it is not permissible for a man to stay away from congregational prayers in the mosque unless he has an excuse. The Prophet (peace and blessings of Allaah be upon him) said: “I was thinking of ordering a man to give the iqaamah, then I would order a man to lead the people in prayer, and I would go with some men carrying bundles of firewood, to people who do not attend the prayer in congregation, and I would burn their houses down around them.”
These people may have prayed, but the Messenger (peace and blessings of Allaah be upon him) wanted them to pray with the congregation that is described as such in sharee’ah, and the congregation that is described as such in sharee’ah is the congregation that prays in the mosque. And the mosques are the places where people are called to come at the time of prayer. Hence ‘Abd-Allaah ibn Mas’ood (may Allaah be pleased with him) said: “Whoever would like to meet Allaah tomorrow as a Muslim, let him regularly attend these prayers where the call to them is given.”
“Where the call to them is given” means the place from which the call is made. This has to do with the five daily prayers.
With regard to Jumu’ah (Friday prayer), it is definitely obligatory to offer it in the mosque.
With regard to naafil prayers, the Prophet (peace and blessings of Allaah be upon him) said: “The best of prayers is that which is offered in one’s house, except the obligatory prayers.”
Based on this, it is better for a person to offer voluntary prayers in his house, apart from the voluntary prayers which are prescribed in the mosque such as the eclipse prayer, assuming that it is not obligatory. And Allaah is the Source of strength. End quote.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him), Majmoo’ Fataawa Ibn ‘Uthaymeen, 15/19
Shaykh Ibn ‘Uthaymeen also said:
It is not permissible for anyone or for any group to pray in the home when the mosque is nearby. But if the mosque is far away, and they cannot hear the adhaan, then there is no sin on them if they pray in a congregation in the house. The heedlessness that some people exhibit with regard to this issue is based on the view of some scholars (may Allaah have mercy on them) that the purpose of praying in congregation is to bring people together in prayer even if that is not in the mosque, and that if people pray in congregation, even in their homes, then they have done what is required.
But the correct view is that it is essential for the congregation to be in the mosque, because the Prophet (peace and blessings of Allaah be upon him) said: “I was thinking of ordering a man give the iqaamah…” End quote.
Majmoo’ Fataawa Ibn ‘Uthaymeen, 15/20.