Self-Sacrifice for the Sanctification of God's Name
Question
Answer
Hello
If a non-Jew forces a Jew to violate a commandment to turn him away from God's will, and there are not ten Jews present, he is not obligated to sacrifice himself except for the three severe transgressions: idolatry, sexual immorality, and murder.
However, if there are ten Jews present, it is considered 'public', and he must sacrifice himself to avoid transgressing any commandment.
Source
Babylonian Talmud (Sanhedrin 74a):
All transgressions in the Torah, if they tell a person: transgress and do not be killed - let him transgress and not be killed, except for idolatry, sexual immorality, and murder.
But it is said about this (there):
This is said only in private, but in public - even for a minor commandment, let him be killed and not transgress. - What is a minor commandment? - Rava bar Yitzchak said in the name of Rav: even to change the straps of sandals. And how many is public? - Rabbi Yaakov said in the name of Rabbi Yochanan: no less than ten people.
Shulchan Aruch, Yoreh De'ah, Laws of Idolatry, Chapter 157, Section 1
All transgressions in the Torah, except for idolatry, sexual immorality, and murder, if they tell a person to transgress them or be killed, if it is in private, let him transgress and not be killed. And if he wishes to be stringent with himself and be killed, he may, if the non-Jew intends to turn him away from the faith.
And if it is in public, that is, in front of ten Jews, he is obligated to be killed and not transgress.