Rainfall is one of the legislated excuses to not attend the congregation.

Proof:

ابْنُ عُمَرَ فِي لَيْلَةٍ بَارِدَةٍ بِضَجْنَانَ ثُمَّ قَالَ صَلُّوا فِي رِحَالِكُمْ، فَأَخْبَرَنَا أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم كَانَ يَأْمُرُ مُؤَذِّنًا يُؤَذِّنُ، ثُمَّ يَقُولُ عَلَى إِثْرِهِ، أَلاَ صَلُّوا فِي الرِّحَالِ‏.‏ فِي اللَّيْلَةِ الْبَارِدَةِ أَوِ الْمَطِيرَةِ فِي السَّفَرِ

Narrated Nafi`:
Once in a cold night, Ibn `Umar pronounced the Adhan for the prayer at Dajnan (the name of a mountain) and then said, “Pray at your homes”, and informed us that Allah’s Messenger (ﷺ) used to tell the Mu’adh-dhin to pronounce Adhan and say, “Pray at your homes” at the end of the Adhan on a rainy or a very cold night during the journey.”

[Saheeh Bukhari no. 632]

Hafidh Ibn Hajr rahimahullah said:

وترجم عليه البخاري غير ترجمة الباب والذي قبله الرخصة في الصلاة في الرحال عند المطر

“Bukhari put a title other than the title of the chapter. The one before it is the allowance for the people to pray in the house when it is raining”

[Fathul Bari]

And also:

عَنْ جَابِرٍ، قَالَ كُنَّا مَعَ النَّبِيِّ صلى الله عليه وسلم فِي سَفَرٍ فَأَصَابَنَا مَطَرٌ فَقَالَ النَّبِيُّ صلى الله عليه وسلم ‏ “‏ مَنْ شَاءَ فَلْيُصَلِّ فِي رَحْلِهِ

Jabir narrated:
“We were with the Prophet on a journey when it started to rain on us, so the Prophet (S) said: ‘Whoever wishes, let him perform Salat in his place.'”

[Saheeh Tirmidhi no. 409]

Imam al-Mubaarakfoori rahimahullah said in commentary:

فيه دليل على أن الصلاة في الرحال لعذر المطر ونحوه رخصة وليست بعزيمة

“In this is evidence that prayer is in the homes due to the excuse of rain and the likes and is an allowance and not an obligation”

[Tuhfatul-Ahwadhi]

Shaikh Ibn ul-‘Uthaymeen rahimahullah:

“From the excuses also is if there rain and mud. In that is difficulty to attend the masaajid. So a person prays in his house. Otherwise, the origin is the obligation of attending the congregational prayer for every man in the masjid”

[Noor ‘ala Darb no. 206]

This is because there is difficulty in going to the masjid. As for light rain, then one must still attend the congregation.

Shaikh Ibn ul-‘Uthaymeen rahimahullah said:

“If it does not harm him such that the rain is light, then there is no excuse. Rather it is obligatory upon him to attend the congregation. And what afflicts him of little difficulty, then he is rewarded”

[Sharh Mumti’ (4/318)]

And Allah Knows Best

Translated by

Faisal Ibn Abdul Qaadir Ibn Hassan
Abu Sulaymaan