Praise be to Allah, and peace and blessings be upon the Messenger of Allah and his family.
In the answer to question no. 5693, we stated that precedence should be given to men in treating men, and to women in treating women. If the patient needs to be examined, precedence should be given to a qualified Muslim female doctor, then to a non-Muslim female doctor, then to a Muslim male doctor, then to a non-Muslim male doctor. If there is a need for a specialist female doctor but none is available, then it is permissible to be examined by a specialist male doctor. If the treatment offered by the female specialist, and the case requires the intervention of a highly skilled, experienced male doctor, that is permissible.
If there is a specialist female doctor who can treat the woman, who is qualified to deal with this case, and it is possible to deal with her, even if she is not Muslim, then it is forbidden for the woman to go to a male doctor; this prohibition is further emphasised if the male doctor is non-Muslim.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked:
Is it permissible for a male doctor to examine a woman in some parts of her body or the ‘awrah, in a case where the sickness is not serious and it is possible for one of the female doctors present to examine her?
He replied:
If it is possible for a woman to be treated by another woman, then it is not permissible for her to go to the male doctor for treatment, especially with regard to issues where the ‘awrah needs to be exposed. That is because uncovering the ‘awrah before one before whom it is not permissible to uncover it is not allowed except in the case of necessity. If there is a female doctor who can treat this woman, then in that case there is no need for the male doctor. It is also not permissible for a man to receive female patients for treatment in cases where that is not permissible for him, if there are female doctors who can take care of that. The prohibition applies to both the patient and the doctor. For the female patient, if there is a female doctor who can do the needful, then she should not go to a male doctor. If a woman comes to a male doctor when there is a female doctor in the hospital who can do the needful, it is not permissible for him to receive female patients in that case. But if there is no female doctor, then it is permissible for the male doctor to treat the female patient, and it is permissible for the female patient to go to the male doctor, because this is a case of necessity.
End quote from Fatawa Noor ‘ala ad-Darb (12/112-113).
For more information on the guidelines with regard to looking at the ‘awrah for the purpose of medical treatment, please see the answer to question no. 5693
Secondly:
There is nothing in what you did that would render the fast invalid, especially since you did not deliberately do anything wrong, as appears to be the case from what you say. Rather there was some confusion that led to this error.
All you have to do is seek forgiveness and repent from this negligence that occurred, and pay attention in the future to those important guidelines with regard to keeping the ‘awrah covered, and remember that a woman should not uncover her ‘awrah before a man for whom it is not permissible to see her ‘awrah.
You do not have to offer any specific expiation such as charity or a fidyah (ransom). All that is prescribed for people in general, if they do something wrong or are heedless, is to follow up that mistake with good deeds and striving to do good, in order to make up for that wrong deed. Allah, may He be exalted, says (interpretation of the meaning):
“And perform As-Salat (Iqamat-as-Salat), at the two ends of the day and in some hours of the night (i.e. the five compulsory Salat (prayers)). Verily, the good deeds remove the evil deeds (i.e. small sins). That is a reminder (an advice) for the mindful (those who accept advice).
And be patient; verily, Allah loses not the reward of the good-doers” [Hood 11:114-115].
It was narrated that Abu Dharr (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said to me: “Fear Allah wherever you are, follow up a bad deed with a good deed to erase it, and have a good attitude towards people.”
Narrated by at-Tirmidhi (1987). He said: A saheeh hasan hadith. It was classed as hasan by al-Albani.
And Allah knows best.