We ask Allaah to set the affairs of the Muslims straight, and keep us and you away from places of turmoil and trials, and to unite them on the truth, and grant them victory against their enemies, for He is able to do that.
Praying in congregation in the mosque is obligatory for men who are able to do that, and there is a great deal of evidence for that which has been explained in the answers to questions no. 120 and 8918.
The obligation of performing prayers in congregation and Jumu’ah prayers is dependent upon there being no danger to a person’s life or wealth or family, because Allaah says (interpretation of the meaning):
“and [Allaah] has not laid upon you in religion any hardship”
“Allaah intends for you ease, and He does not want to make things difficult for you”
Ibn Qudaamah (may Allaah have mercy on him) said in al-Mughni (1/366): The one who is afraid is excused for not praying in congregation or praying Jumu’ah, because the Prophet (peace and blessings of Allaah be upon him) said: “Valid excuses are fear and sickness.”
Fear is of three types: fear for oneself, fear for one’s wealth or property, and fear for one’s family. End quote.
If a person fears that he may be killed or arrested and imprisoned unlawfully, then this is regarded as a valid excuse for his not praying in congregation or praying Jumu’ah, and he may offer these prayers in his house in order to protect himself.
But if he prays Jumu’ah in his house, then he should pray it as Zuhr with four rak’ahs, not like Jumu’ah prayer.
And Allaah knows best.