Assalamu alaikum Mufti Saab.
Is it allowed for a woman to be a nurse if her job requires her to treat men also? And is this the same for men becoming doctors and nurses etc. as they are required to treat both genders? This is, particularly in our western countries. I don't know how it works in Islamic countries.
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيْم
In the name of Allah, the Most Gracious, the Most Merciful
Due to the nature of the medical treatment, in an ideal Muslim setting, male doctors and nurses would treat male patients, and female doctors and nurses would treat female patients — this is especially true when examination or treatment requires uncovering the patient's ʻawrah/nakedness. However, a medical practitioner of the same gender is not always available, and furthermore, it is actually illegal in many places for a doctor or nurse to refuse to treat a patient of the opposite gender. Hence, exceptions are permitted due to the principle of need in Islāmic Law, but only to the extent of its necessity. Imām al-Ḥaṣkafī states: "And for medical treatment, in that, a male doctor may look at (and treat) the affected area (of a woman's body) but only to the extent of need, for cases of need are restricted to the actual need… And it is preferable that the male doctor teaches and instructs a female to treat her, for looking at (and treating) someone from the same gender is a lesser of evil".
It is permissible for a man or woman to be a doctor or nurse even if their job requires examination and treatment of patients of the opposite gender — but certain conditions must be followed:
a- The doctor or nurse should limit any contact with patients of the opposite gender to only what is absolutely necessary and keep the interaction professional.
b- Seclusion (khalwah) with the patient should be avoided, either by keeping the room open or by having another person present (such as another medical practitioner, secretary, or family member of the patient). If the doctor or nurse finds themselves tempted during interactions with patients of the opposite gender, it would be best for them to switch professions.
Only Allah knows best
Written by Shaykh Umer Khan
Checked and approved by Mufti Mohammed Tosir Miah
Darul Ifta Birmingham
 Raddu al-Muḥtār, 6/371