Islam has stipulated very strict rules with regard to the permissible boundaries of interactions/physical contacts between males and females who are not related either through marriage or blood relations.
According to these rules, it is considered Haram for males and females who are not related in marriage or blood to be in private or come into direct physical contacts with one another. As everything that leads to Haram is Haram, they ought to avoid circumstances or avenues that might lead to such close contacts as far as possible.
The above rules are designed specifically to protect us against our own vulnerabilities and weaknesses for as Allah says in the Qur’an, “Verily man/woman has been created weak.” (An-Nisa’: 28) As one poet rightly remarked, “All illicit relations can be traced to a single unlawful gaze, just like all burning fires often proceed from a single spark.”
Since Islam takes into account the realities of everyday life, and, therefore there may be situations where such contacts are necessary, and therefore unavoidable, the scholars of Shari`ah have allowed certain exceptions to the above rule: Thus they have considered such contacts permissible if undertaken strictly for the purpose of saving lives or administering essential treatments wherever applicable. This special ruling falls under the rule of necessity, which stipulates that in exceptional cases what has been otherwise considered as impermissible becomes permissible.
In order to qualify for permission under the rule of necessity, however, certain conditions apply: Firstly, the physician of the same gender must be unavailable; secondly, contacts should be kept to the absolute minimum limit as necessary.
Dr. Marawan Shahin, Professor of Hadith and its Sciences, Faculty of Usul Ad-Din (Theology), Al-Azhar Univ. states the following: “Originally men should treat men and women should treat women unless there is an extreme necessity which warrants otherwise as clarified above.