When a pregnant woman is knowingly causing harm to her unborn child, there are various legal interventions that can be taken to protect the rights if the fetus.
Performing a pelvic exam without consent on an anesthetized woman, even for teaching purposes, is unethical and considered sexual battery in some jurisdictions.
Residents and attending physicians have an ethical responsibility to speak up if there is a concern that a colleague lacks clinical skills and is providing inadequate patient care.