Ruling on stopping one’s prayer if something serious happens
If a prayer is naafil (supererogatory), there is more room for manoeuvre, and it is o.k. to stop praying in order to find out who is at the door. But in the case of a fard (obligatory) prayer, it is not permissible to stop it unless there is something important which one is afraid of missing. If it is possible to alert someone else, by saying “Subhan-Allaah” out loud in the case of men and clapping in the case of women, so that the person at the door will realize that the person in the house is busy praying, that will do away with any need to stop praying. The Prophet (peace and blessings of Allaah be upon him) said: “Whoever is alarmed by anything whilst praying, let men say ‘Subhan-Allaah’ and let women clap.” (Agreed upon. Al-Bukhaari, 1234; Muslim, 421).
If it is possible to let the person who is at the door realize that the person inside the house is praying, by clapping in the case of women and saying ‘Subhan-Allaah’ in the case of men, whilst still praying, this will save you from having to stop the prayer. If that will not work, because one is too far away from the door or the person outside will not be able to hear, then it is o.k. to stop the prayer if necessary, especially if it is a naafil prayer. But in the case of an obligatory prayer, if it is something important or necessary, and there is the fear of missing it, it is also o.k. to stop the prayer, and to repeat it from the beginning. Praise be to Allaah.