[19]. Congregational prayer is obligatory for all men in the mosque. It is not permissible for a man who is able to attend the congregational prayer in the mosque to pray in his house even if he prays in congregation with his family.
the Prophet Muhammad ﷺ said: “Whoever hears the call to prayer and does not come, there is no prayer for him [i.e., his prayer is not valid], unless he has an excuse. It was asked the companion of the prophet, what is an excuse? He said, Fear or sickness.