Praise be to Allah.
There is nothing wrong with the (male) doctor touching a man’s ‘awrah in cases of necessity, or looking at it for the purpose of medical treatment, whether that is the front or the back. He may look at it and touch it in cases of necessity. And there is nothing wrong with touching blood if there is a need to touch it during an operating in order to remove it or to check on the wound. He should wash his hands after that to remove any blood that may have gotten onto them. Touching blood or urine does not invalidate wudoo’, but if he touches the ‘awrah, whether front or back, this invalidates his wudoo’. But touching blood or urine, or other impure substances, does not invalidate wudoo’, rather he should wash off whatever gets onto his hands. But whoever touches the private parts without any barrier in between i.e., skin to skin, invalidates his wudoo’, because the Prophet (peace and blessings of Allaah be upon him) said: “Whoever touches his private parts with his hand, with no barrier in between, must do wudoo’.” The same applies to a female doctor if she touches the private part of a woman for an essential reason, this invalidates her wudoo’ if she was in a state of purity, just as in the case of men.