Praying in congregation in the mosque is obligatory for men who are able to do so, according to the more correct scholarly opinion, because of a great deal of evidence which has been discussed in the answer to question number 120 and 8918.
Although praying in congregation is obligatory, it is waived in certain cases which were mentioned by the scholars, one of which is rain which makes the clothes wet, because Allaah says (interpretation of the meaning):
“and 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): (A man) may be excused for not praying Jumu’ah or offering prayers in congregation because of rain that makes the clothes wet, or mud that causes annoyance or stains the clothes. It was narrated that ‘Abd-Allaah ibn ‘Abbaas said to his muezzin on a rainy day: When you say: I bear witness that there is no god but Allaah and I bear witness that Muhammad is the Messenger of Allaah, do not say, Come to prayer, rather say: Pray in your houses.
It was as if the people found that strange, so he said: Are you surprised by that? One who is better than me did that. Jumu’ah is obligatory, but I did not want to force you to walk in the mud and on slippery ground. End quote.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said in al-Sharh al-Mumti’ (4/317): With regard to the phrase “or harm caused by rain or mud”, this is a tenth type of excuses for not praying Jumu’ah or prayers in congregation. If a person is afraid of harm caused by rain or mud – i.e., if it is raining and if he goes out to attend Jumu’ah or prayers in congregation he will be harmed by the rain, then he is excused.
Harm caused by rain means being harmed by his clothes getting wet or by the cold weather and so on. The same applies if he is afraid of being harmed by the mud. In the past, people used to suffer because of mud, because the marketplaces had dirt floors, and when rain fell it became muddy and slippery, so it was very difficult for people to attend the mosque. If this happens, then he is excused. But nowadays, that does not cause any problem, because the markets are paved and there are no dirt floors. The worst that can happen is that you will find that the water ponds in some low spots, but this does not affect people or their clothes or their feet. The excuse in this case only applies if rain is falling, and when it stops there is no excuse. But in some villages where there is no paving, the excuse may still apply. Hence the caller of the Messenger (blessings and peace of Allaah be upon him) would call out on cold or rainy nights: “Pray where you are.”
It may be understood from the words “or harm because of rain” that if a person will not be harmed by it because the rain is light, then there is no excuse in that case; rather he has to attend the prayers, and whatever minor hardship he is faced with, he will be rewarded for it. End quote.
And Allaah knows best.