All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
It is permissible for a male Muslim doctor to examine a female marriageable patient on the following conditions:
1. In case there is no female doctor who could do the task.
2. He should not expose her body except to the extent that is needed to be exposed, and if there is a necessity to expose the private parts, it would be permissible.
3. He should not be in seclusion with her; she should be in company with one of her male Mahaarim (i.e. non-marriageable relatives), or anyone else so that she would not be alone with him.
4. He should only look to what is needed to be examined and looked at.
In addition to the above, he should always bear in mind that Allaah is watching him and that Allaah Knows what he does, and he should avoid being tempted by the devil and attracted and seduced by women.
Based on the above, if there is no female doctor who could do what is asked in the question and there is a necessity to expose and touch the private parts in order to treat the female patient, we hope that there is no sin on the questioner. Indeed the scholars have stated this. Another scholar Al-Khateeb Ash-sharbeeni said in Mufti Al-Muhtaaj: '…this should be in the presence of one of her Mahaarim or husband on the condition that there is no female doctor who would examine or treat the female patient and vice-versa [i.e. a male patient being examined by a female doctor].'
As regards fasting, it is not invalidated because of that as this is not like eating and drinking, however, if the male doctor transgresses the limits of Allaah, like looking or touching what is beyond the necessity, then it could be that he might lose the reward of fasting as the Prophet said: "Whoever does not abandon [dealing with] false testimony and sinning, then Allaah does not need him to abandon his food and drink." [Al-Bukhari]
As regards ablution, it is not invalidated by looking at the 'Awrah [parts of the body that must be covered in Islam] but it is invalidated by touching the private parts according to some scholars as per Prophetic narration: "Whoever touches his penis [private parts], he has to perform ablution." [An-Nasaa'ee]
With regard to touching the other parts of the body of the female patient other than the 'Awrah, the scholars differed in opinion in relation to whether or not ablution is invalidated by doing so. Some of them are of the view that ablution is invalidated by merely touching the body whether it was with or without a desire, some others are of the view that ablution is not invalidated and some others are of the opinion that if the touching is accompanied with a desire, then ablution is invalidated, and if it was without a desire then ablution is not invalidated. Anyway, in order to be on the safe side, it is better to renew ablution in each case.
Allaah Knows best.