Every person has their own comfort zone and needs which need to be met to ensure that they are able to cope with their medical appointments. Sometimes your comfort zone gets invaded but you also have to cope.
At my first cancer surgery, I was mortified to find out I woke up after the operation wearing a different gown than when I was sedated. Did they see me naked???? I didn't dare ask. I also remember the first time I went for a gynecological exam and it was a male doctor!!!! I had grown up with a female pediatrician and wasn't used to male doctors. I coped and was okay with it but mortally embarrassed.
In the case of Muslim men and women where there are strict guidelines on men and women being in the same room, never mind touching each other, if they are unmarried, medical exams can be restricted or just very difficult. It is not just Muslims that have this issue where their religion forbids it but anyone who's comfort zone does not allow for someone of the opposite sex to touch them. Some people are also just very modest and don't want someone of the opposite sex to touch them.
When my husband needed a primary care physician, I asked him his preference - male or female - and he definitely wanted a male doctor. To this day, I usually prefer a female doctor myself. Currently, the only male doctor I have is my back pain doctor. I think all the others are female, some by my decision and some by chance.
If you think about it, boys and girls are different (in many ways) and I prefer a doctor who has the same body parts I have. Ovarian cysts don't happen to boys. Hysterectomies don't happen to boys. I want a doctor who can understand my body better and what is going on with it.
I am not saying women should only have female doctors and men only have male, I am saying that this is what I am comfortable with personally. This is my comfort zone. If someone has the added issue of religious dictates, they should be respected as much as possible.