Pesachim 25 - Three important things
Even when eating prohibited foods, one is only liable to punishment if he does it in the normal way people eat - these are the words of Rabbi Abahu. What would be an example? - If he takes that fat that is to be burned on the Altar and swallows it raw instead. A stricter version of this teaching prohibits even that, and allows only the unusual manner of benefiting, such as putting this fat on a wound with medicinal purposes.
Rabbi Yakov said that three things one should not do, and the first one is healing himself with idolatry. But his life may be in danger!? - Yes, that is what he meant, even if the life is in danger. Why? Because the Torah said, "You shall love your God with your soul and with your possessions." This is talking about two kinds of people, for some their money is more important than life, and for others their life is more important, and even so there are situations where one must give up his life.
The other two things are illicit relations, even if his health is in danger without them, and even if he is facing an ultimatum to do it, and killing someone. The latter is derived by logic: how do you know that your blood is redder than his, that you are willing to kill him in order to save your life?
Art: Sickness and Health, 1843 by Thomas Webster