H/T Rabbi Torczyner.
Binyan Tzion I:75 (Rabbi Yaakov Ettlinger) addresses a rabbi who was asked "may I deliver my sister-in-law's baby?" Halachically, inappropriately touching your sister-in-law is no different than inappropriately touching random married-to-someone-else woman, but there's perhaps a certain "eww" factor that prompted the question.
... [many authorities] agreed with Shach, that while deeply focused on one's profession there is no prohibition on touching a prohibited woman; and the Kreisi UPleisi [R. Yonasan Eibeschutz] wrote that it is common practice that a woman with a wound in her stomach or other private areas, that doctors will look at it.
Though in my humble opinion, a good G-d fearing doctor will attempt to avoid delivering babies if another doctor is available, as regardless it is distasteful and it will bring one to inappropriate thoughts. HOWEVER those who are lenient certainly have what upon to rely ... therefore for Jewish doctors who are in the practice of delivering the babies of married women [other than their wives] even if non-Jewish doctors are available, delivering one's sister-in-law would also be permissible. That's how it appears to me.