Ibn ‘Umar narrated that the Prophet ordered the mu’azhzhin to say: “Pray in your places,” on a cold, stormy night during a journey. This is related by alBukhari and Muslim.
Jabir said: “We went on a journey with the Prophet and it rained upon us, so he said: ‘Whoever wishes may pray in his stopping place.'” This is related by Ahmad, Muslim, Abu Dawud, and at-Tirmizhi.
Ibn ‘Abbas said to the mu’azhzhin, on a rainy day: “When you say ‘I bear witness that Muhammad is the Messenger of Allah,’ do not say ‘Come to the prayer,’ but instead say ‘Pray in your houses.”‘ The people didn’t seem to like it, so he asked: “Are you surprised by that? One better than me did it [the Prophet]. The congregational prayer is a strict order but I hated that you should go out and walk in the mud and on slippery ground.” This is related by al-Bukhari and Muslim. According to Muslim’s version, this occurred on a Friday.
What applies in case of cold would also apply in cases of extreme heat, darkness, and fear of an oppressor. Ibn Batal writes: “The scholars are agreed on the permissibility of not attending the congregation due to heavy rain, darkness, wind, and so on.”
Ibn ‘Umar reports that the Prophet sallallahu alehi wasallam said: “If the food is presented to one of you, do not rush but fulfill your need of it even if the salah has begun.” This is related by al-Bukhari.
‘Aishah narrates that she heard the Prophet sallallahu alehi wasallam say: “There is no prayer when the meal is presented nor when one needs to answer the call of nature.” This is related by Ahmad, Muslim, and Abu Dawud.
Abu ad-Darda’ says: “It is a sign of the understanding of a person that he fulfils his needs first in order to make his prayer with a clear mind.” This is related by al-Bukhari.