Praise be to Allah.
Praying in congregation is obligatory.
This is what is indicated by the shar’i evidence from the Qur’aan and Sunnah. As Allaah has enjoined prayer in congregation in the battlefield, so it is more appropriate that it is obligatory at times of stability and peace. This has been discussed in the answer to question no. 120 and 8918.
It is obligatory to pray in congregation in the mosque, not in workplaces or schools.
This applies if the Muslim is accountable, male, able to do it and can hear the adhaan without the aid of a loudspeaker.
This is indicated by the fact that the Prophet (peace and blessings of Allaah be upon him) thought of burning down the houses of those who prayed at home, even though they may have prayed in congregation.
It was narrated that Abu Hurayrah (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “I was thinking of ordering that the iqaamah for prayer be given, then I would tell a man to lead the people in prayer, and I would set out with men carrying bundles of firewood, and go to people who do not attend the prayer and burn their houses down around them.” Narrated by al-Bukhaari (657) and Muslim (651).
This has been discussed in the answer to question no. 72398.
Hence there is no comparison between prayer in congregation at home and prayer in congregation in the mosque. The reward and virtue come from praying in congregation in the mosque. The one who does not pray in congregation in the mosque and chooses to pray in congregation at home or in the workplace does not attain the reward of praying in congregation in the mosque, if he is free from sin in the first place.
The one who has an excuse for not attending prayer in congregation in the mosque will have the same reward as those who pray in congregation, even if he prays at home.
A Muslim may be excused for not praying in congregation in the mosque, such as if he is far away and the sound of the adhaan in its natural form does not reach him, or he is sick, or afraid. If that is the case, then he should pray in congregation with the members of his family who are not obliged to pray in congregation, or those who have a similar excuse. Here it is valid to differentiate between the congregation in the mosque and the congregation of these people in terms of numbers. The congregation that is greater in number is more beloved to Allaah – and we shall quote the relevant hadeeth below – but there is no room for comparison of other rewards, such as the number of steps that the worshipper takes to the mosque, or coming early to pray, and Allaah preparing a welcome in Paradise every time he comes and goes, and so on. These rewards are denied to the one who prays in his house, unless he is one who regularly prays in the mosque but is kept from doing so by sickness or some other reason, in which case a reward will be decreed for him like that which he used to do, as is stated in a saheeh hadeeth from the Prophet (peace and blessings of Allaah be upon him).
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said:
For the one who is excused, the reward will be decreed if it was his habit to pray in congregation, because the Prophet (peace and blessings of Allaah be upon him) said: “If a person falls sick or travels, there will be decreed for him a reward like that for what he used to do when he was healthy or not travelling.”
Al-Sharh al-Mumti’ (4/323).
If a man does not have anyone to pray with, he may pray alone, but the more people who pray, the dearer that is to Allaah.
If a person deliberately misses the first jamaa’ah (prayer in congregation), he is sinning, but his praying in congregation is better than his praying alone, although he will not have the reward of the first jamaa’ah
Those who delay it without any excuse and aim to pray with the second or third jamaa’ah – as happens in some marketplace mosques – are sinning by deliberately missing the first jamaa’ah, and they are deprived of the reward even if they pray in congregation with a group that is larger than the first jamaa’ah.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said:
As for the view of those who say that if they pray in the mosque, even if that is after the first jamaa’ah, they will have the twenty-seven-fold reward, this is not correct. The twenty-seven-fold reward applies only to the first jamaa’ah. As for the second jamaa’ah, undoubtedly praying in congregation is better than praying individually, because the Prophet (peace and blessings of Allaah be upon him) said concerning a man who entered the mosque and had missed the prayer: “Who will give charity to this man and pray with him?” and one of the people got up and prayed with him. And he (peace and blessings of Allaah be upon him) said: “A man’s praying with two other men is better than his praying with one other man, and the more there are, the more beloved that is to Allaah, may He be glorified and exalted.” But as for the second jamaa’ah attaining the same reward as the first, this is not correct. Otherwise people would go to the mosque whenever they wanted, and they would pray in congregation and say, We have gotten the twenty-seven-fold reward. But I do not know of anyone who says that, i.e., that the second prayer is like the first in terms of attaining the twenty-seven-fold reward. I do not know of anyone who says this.
Liqa’ al-Baab il-Maftooh (44/question no. 10).
But if a person is late because of an excuse, and he enters the mosque when the prayer had ended, then the reward for praying in congregation will be decreed for him even if he prays alone.
It was narrated from Abu Hurayrah (may Allaah be pleased with him) that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “If a person does wudoo’ and does it well, then sets out for the mosque but finds that the people have already prayed, Allaah will decree for him a reward like that of those who prayed and were present, and that will not detract anything from their reward.”
Narrated by Abu Dawood (564), al-Nasaa’i (855); classed as saheeh by al-Albaani in Saheeh Abi Dawood.
In ‘Awn al-Ma’bood (2/192) it says:
This applies if the delay did not stem from any shortcoming. End quote.
And Allaah knows best.