As teenage boys in Hebrew school, we always tried to figure out ways in which violating the commandment against adultery could save a life.
If I remember correctly there are 3 things you can't do to save a life: illicit relations, take a life and idolatry.
Meaning even that if you do find yourself in a situation where cheating on your wife would actually save a life then it will still be forbidden
Yeah, there's actually an explicit example in the talmud.
https://www.sefaria.org/Sanhedrin.75a.2?lang=bi&with=all&lan...
definitely prohibited
EDIT: actually this gemara is an example of saving ones own life, so maybe not
https://en.wikipedia.org/wiki/613_commandments
But the sanctity of life trumps virtually all of them, so you can almost always violate a commandment to save a life.
https://en.wikipedia.org/wiki/Pikuach_nefesh