Sayyiduna Jabir (may Allah be pleased with him) narrates that we were on a journey with the Messenger of Allah (peace be upon him) when it rained upon us, so the Prophet (peace be upon him) said: "Whoever among you wishes, let him pray in his tent."
And the evidence that the command of the Prophet, peace and blessings be upon him, regarding that is a command of permission and not a command of obligation, is that one who does otherwise is not sinful if he attends the congregational prayer in the rain.
Hadith Referenceصحيح ابن خزيمه / جماع أبواب العذر الذى يجوز فيه ترك إتيان الجماعة / 1659