The basic ruling is that seeing people’s private parts is strictly haram (prohibited), and it cannot be deemed permissible except in case of necessity which is to be governed by the circumstances that surround it. It is also obligatory for male doctors to treat men and female doctors to treat women, except in cases of extreme necessity.

Sheikh `AtiyyahSaqr, former head of Al-Azhar Fatwa Committee, states: Any work that amounts to seeing people’s private parts is strictly haram (prohibited), and it cannot be deemed permissible except in case of necessity when it is hard to find a doctor from the same gender. It is known that necessity is governed by the circumstances that surround it. Thus, it is not allowed to misuse the dispensation granted by the Shar`iah.
It is allowed for a woman to work as a nurse and to treat people of the opposite sex in case of necessity. The proof for the permissibility may be derived from the Hadith which indicates that the Prophet (peace and blessings be upon him) gave permission to a man to do cupping for a woman.
In FathAl-Qadeer it is reported that `Abdullah IbnAz-Zubayr hired a woman to be a nurse for him, and she put stitches in his leg and dressed his head.
In his book Al-Adab Ash-Shar`yyah, IbnMufleh states that if a woman gets sick and she does not find someone to treat her except a man, then according to the law of necessity, it would be allowed for him to look at her body even the private parts (for medical reason). The same applies to a woman treating a man. IbnHimdan and others are reported to have held the same view, based on the hadith that mentions that the Prophet (peace and blessings be upon him) gave permission to a man called Abu Tayba to do cupping for a woman.

The late Muslim scholar, Sheikh ibnBaz, the former Mufti of Saudi Arabia, stated:

All hospitals have to ensure that male nurses treat men and female nurses treat women. This is obligatory, just as it is obligatory for male doctors to treat men and female doctors to treat women, except in cases of extreme necessity, just like the case when a case can only be diagnosed by a male doctor. The same applies when only a female doctor can attend to the case at hand. Otherwise, the normal ruling should be applied, whereby male doctors attend to male patients and female doctors attend to women. The same applies to nurses, both female and male. The reason why Shari`ah lays a great emphasis on this is to avoid the means that may lead to temptation and to prevent khalwah (being alone with a non-Mahram).