What is the halacha regarding averot that one must not do even to avoid death? I have heard, but do not believe it to be correct, that the halacha is that one must prefer death to (1) forced conversion to another religion, (2) cursing the name of G-d, and (3) (one other which I forget!). This seems to me contrary to the idea that the laws are for life, and not that life is for the purpose of the laws, for example, it is permitted to eat tref in order to save one's life. Please instruct me on these questions. Thank you.

Mark, welcome to Mi Yodeya, and thanks very much for the interesting question! I hope you'll look around and find other Q&A of interest and stay learning with us. And if you haven’t done so already, you should take a look at the tour
– mblochFeb 25 '16 at 4:28

Very important to note,that the SA(Rama) 157 explains that if one doesn't give his life then he made a chilul HaShem and is patur because he is considered an o'nes,this only applies if the person wasn't able to run away but if he was able to run away then it's considerd a case of meized.כל מקום שנאמר יהרג ואל יעבור אם עבר ולא נהרג אע"פ שחלל השם מכ"מ נקרא אנוס ופטור ודוקא שלא יוכל לברוח אבל אם יכול לברוח ואינו עושה הרי הוא ככלב שב על קיאו ונקרא עובר במזיד (ב"י בשם הרמב"ם פ"ה דיסודי התורה). }
– samFeb 29 '16 at 2:38

3 Answers
3

The gemara (Sanhedrin 74a) lists three sins which a person should choose not to transgress, even at the expense of his life. They are idolatry, murder, and sexual impropriety.

According to Ramba"m, one must also die to avoid public desecration of God's name (e.g. if someone threatens to kill you if you do not perform a sin in public) or when there is a public decree in the land against performing mitzvot. In those cases, death should be chosen over any sin.

This seems to me contrary to the idea that the laws are for life, and not that life is for the purpose of the laws, for example, it is permitted to eat tref in order to save one's life.

I disagree with your claim. I think to some extent, the purpose of life is to follow the laws in order to get closer to God. Eating non-kosher food in order to survive allows us to perform more mitzvot that we wouldn't get a chance to do it we were dead. But if the purpose of life is to get close to God and sanctify his name, it makes sense that we should choose death over doing something that desecrates the name of God.

There is a verse that seems to say to live through or by means of the mitzvot. We shall see later that this is not quite an injunction. The verse say's "VeHay Bahem".
We will begin the study of the subject by the following assertion. (Gemara Sanhedrin 74A)

תניא א''ר ישמעאל מנין שאם אמרו לו לאדם עבוד עבודת כוכבים ואל תהרג מנין שיעבוד ואל יהרג ת''ל {ויקרא יח-ה} וחי בהם ולא שימות בהם {Has it not been taught: R`Ishmael said: whence do we know that if a man was bidden, 'Engage in idolatry and save your life', that he should do so, and not be slain? From the verse, [Ye shall therefore keep my statutes and my judgements,' which if a man do] he shall live in them: but not die by them. I might think that it may even be openly practised. but Scripture teaches, Neither shall ye profane my holy name; but I will be hallowed? '}

This is not the opinion retained for the Halacha but it is good as an introduction to the subject, because his reference to our verse around the law of "Yeahreg Veal Yaavor". Rabbi Yshmael reads our verse as an injunction, saying that attachment to Mitzvot is not to take over life. But we looked earlier that perhaps the message of the Torah is prognostic in nature. The Torah's message may be: the prognosis (of the Torah) is that thanks to the mitzvot you live (finally). We will trying to visit this subject according to another of drashath Chachamim.
We have already announced that according to the Sifra it is a promise:

You will live in the "'next' world" (after the live).
Appaently the two Hazal contradict one another.
Rabbi Yshmael will continue and clarify that there is a principle of passing life before the offense mitzvot is inapplicable when it comes to break publicly:

He learned this from another verse we will examine.
וְלֹא תְחַלְּלוּ אֶת שֵׁם קָדְשִׁי וְנִקְדַּשְׁתִּי בְּתוֹךְ בְּנֵי יִשְׂרָאֵל אֲנִי ה' מְקַדִּשְׁכֶם:
Let's reading and comment the Sifra:
ולא תחללו
שומע אני ממשמע שנאמר ולא תחלל אמור קדש (the verb should be in the active form "Sanctify") וכשהוא אומר ונקדשתי מסור את עצמך וקדש שמי.
יכול ביחיד?
תלמוד לומר:(This occurs, (i.e. that the gift of your life leads to sanctification of My Name)). בתוך בני ישראל המרובים.(Among the children of Israel (that is to say in the presence of an assembly of Jews))

Now consider the dialectic between the promise of life and the importance of ensuring name (that is to say a public renown of G_d). We will guide our reflection. There is in a Jewish act (i.e wen a Jew makes an act) an expression, in the same way that mention name denotes an object. This dimension is obvious when the actions of a man are public. For a Jew, his public activity is related to the meaning of the name G_d.

A second step is to note that there are highly expressive acts. In this they are similar to language. Such as bow down to an idol. Let's say that acting in such acts is like talking. In this perspective, idolatry in general is more meaningful than the desecration of Shabbat.

The third step of our reasoning is to see in certain acts such degree of meaning they disturb man, even when he is alone. It is here that fits the divergence between Rabbi Yshmael and Chachamim:
Sanhedrin hop. cit.

Idolatry, even in the discretion is "Yahreg Veal Ya'avor" d/t his expressivity.
Regarding the other two offenses It's different. (And besides, there is no Machloketh).

The Gemara say's about the killing:

מי יימר דדמא דידך סומק טפי דילמא דמא דהוא גברא סומק טפי

"Who says your blood is redder than his?" We can not justify thinking of saving himself by causing the death of another.
Gilui Arayoth may be similar perhaps to the latter. But I confess really did not understand.

Returning to the beginning of the remarks of Rabbi Ishmael. He sees in the verse "Vechay Bahem" a message that the effort not to violate must not take over the life which is assumed to be a value as there is a promise of life (life in general).

As Daniel wrote the three averot that one must not do even to avoid death are Avoda Zara (idolatry), murder, and Gilui Arayut (sexual impropriety)

Rabbi Nevanzal (his books of the parasha) explained why are these three are the averot that one must not do even to avoid death. He explains that these three are working against the way of life...

1 - Avoda Zara - Our whole purpose of life is to embrace G-d so worshiping anything else will differ the purpose of life. (This doesn't mean that you rather die than to convert another religion. We rather die only if the other religion isn't monotheistic.)

2 - Murder - Well our goal is to bring life not destroy life... (I rather die than kill also because who says that my blood is better than someone else)

3 - Gilui Arayut (sexual impropriety) - I forgot his reason.

At the end he also says that all three are really a form of Avoda Zara (idolatry), but I also forgot how he got to this.