Yeihareig Ve-al Ya'avor and Kiddush Hashem
The mitzva of kiddush Hashem generally divides into two different categories. During a period of 'gezeira,' when a direct challenge to Judaism has been leveled, a person must sacrifice his life to avoid violating any and every mitzva. Whether this applies only to a public setting (the prospect of violating the aveira in public) or even in a private setting, is debated by the Rishonim in Sanhedrin (74). In this scenario, it is clear that the aveira itself does not warrant the sacrifice of life. The rule of pikuach nefesh ("ve-chai ba-hem ve-lo she-yamut ba-hem") should be invoked here just as it is in any context in which halakha will endanger life. Even without this principle, as the Jew is subject to coercion, he is considered an onnes and should thus be exempt from the particular aveira. What does mandate the sacrifice of life is a separate mitzva of kiddush Hashem – 'Ve-nikdashti be-tokh benei yisrael.' The sin itself is not binding, but in this context every Jew has a mitzva asei to defy the challenge to his emuna and sacrifice his life in so doing.
Furthermore, some Rishonim claim that anytime a Jew is demanded to violate an issur in public, he must sacrifice his life instead. Even if no widespread gezeira has been issued, any public setting is automatically considered an attack on the Jewish religion. Even though the particular aveira does not require sacrificing one's life, the mitzva to sanctify Hashem's Name does.
A second category of the mitzva applies to someone who is challenged to violate one of the three cardinal sins - avoda zara (paganism), giluy arayot (illicit sexual behavior) or shefichut damim (murder). Even if asked to commit these sins in private, and based on the private initiative of an individual (rather than a general decree), a Jew must sacrifice his life to avoid these violations. With regard to this category, an interesting question may be raised. Are these instances similar in nature to the first category? Do we claim that in these situations, as well, the actual aveira no longer applies (since the person is being coerced), but the sacrifice must be made to sanctify Hashem's Name? Anytime these cardinal sins occur Hashem's name is disgraced – even if they are performed in private. The demand to sacrifice life thus perhaps stems from the mitzva of kiddush Hashem and not from the actual aveira. Or, do we claim that in these three instances the rules of piku'ach nefesh and onnes do not apply? Even though preserving life generally takes precedence over all mitzvot in the torah, it does not take precedence over these cardinal sins.
To summarize: does the requirement to sacrifice one's life rather than violate the three severe sins stem from the separate mitzva to sanctify Hashem's name, or from the unique stringency of these sins, rendering them applicable even at the cost of human life?
Perhaps this question may be grasped by examining a machloket between the Ba'al Ha-ma'or and the Ramban. The Ba'al Ha-ma'or (Sanhedrin 74) ruled that if the 'coercer's' motive is personal - because he will derive some personal satisfaction from this violation, the Jew is excused from yeihareg ve-al ya'avor. If, however, his demand stems from ideological motives, the sacrifice must be made. Clearly, the Ba'al Ha-ma'or viewed the halakha as deriving from the mitzva to sanctify Hashem's Name. If the motives are personal, no challenge exists, no opportunity for sanctification presents itself and no sacrifice must be made. The Ramban, in his Milchamot Hashem, disputes the Ba'al Ha-ma'or's position and claims that when faced with the prospect of violating these three aveirot, life must be sacrificed regardless of motive. The motive of the coercer is only significant with regard to other aveirot during a time of gezeira. Since, in these instances, yeihareg ve-al ya'avor stems only from the mitzva of kiddush Hashem, it applies only if the gentile challenges along ideological lines. In the case of the three cardinal sins, by contrast, the demand of yeihareg ve-al ya'avor is based upon the inherent severity of these aveirot, and life must be sacrificed even if the motive is not ideological.
A second debate which might evolve from this question surrounds the prospect of yeihareg ve-al ya'avor when the violator remains totally passive. Based upon the aforementioned gemara in Sanhedrin, Tosafot (Ketubot 3b and Sanhedrin 74b) quote the Rivam who claims that if a person is completely passive in violating one of the three sins, he does not have to sacrifice his life. The Rambam in Hilkhot Yesodei Ha-Torah perek 5 does not accept this position (see Rav Chayim Brisker's comments for a fuller discussion of this machloket). Potentially, the Rambam may have viewed the mandate to sacrifice life as based on the potential chillul Hashem. If so, it would make little difference whether the Jew plays an active or passive role in the violation committed. Merely by consenting to participate in this act, the Jew prioritizes his life over his love of God and thereby desecrates Hashem's Name. Remaining 'mechanically passive' does not exempt him from yeihareg ve-al ya'avor according to the Rambam. The Rivam might have contended that the yeihareg ve-al ya'avor stems from the severity of the actual aveira; these aveirot must be avoided at all costs. Perhaps passive participation is not considered a elementary violation of the issur and therefore yehareg ve-al ya'avor would not apply.
A third manifestation of this question might be the potential penalty for someone who fails to perform yeihareg ve-al ya'avor but instead violates the issur. The Rambam (aforementioned perek) rules that although in such a case one has failed to properly perform the mitzva, he does not receive any punishment. Since he was coerced, he is not considered in violation of the aveira of murder or sexual deviation. He merely faces a new mitzva of sanctifying Hashem's name. Indeed, he failed to execute this mitzva; his failure, though, does not warrant a penalty for murder or sexual deviation. Other positions claim that he does receive an onesh for murder or for sexual deviation. Presumably, he agrees with the Ramban: the halakha of yeihareg ve-al ya'avor develops form the fact that these severe aveirot apply even in a case of onnes.
The gemara in Pesachim (25a) asserts that to save someone from a life threatening medical crisis, any aveira may be performed – except the three cardinal sins. In this instance, no one coerces the patient and no challenge to Judaism is being levied. Presumably, the mitzva of kiddush Hashem does not apply AND YET yeihareg ve-al ya'avor does obtain!! Does this not indicate that the obligation of yeihareg ve-al ya'avor stems from the internal severity of these sins, that these violations are so significant that they must be avoided even at the cost of human life – regardless of whether that life is shed by an ideological opponent or simply sapped by a medical situation? If the rule of yeihareg ve-al ya'vor is based upon kiddush Hashem, it becomes more difficult to explain its application in the absence of an ideological challenge.
A final related issue might pertain to the potential of yeihareg ve-al ya'avor for a gentile. Would he be obligated to sacrifice his life to avoid violating the three cardinal sins – all of which are included in the seven mitzvot benei noach, which apply to non-Jews as well? The Bavli (Sanhedrin 74b) raises the question while the Yerushalmi (Sanhedrin 3:5) rules that a gentile is not obligated in yeihareg ve-al ya'avor. Conceptually, if we view yeihareg ve-al ya'avor as based upon the internal severity of the respective aveirot, we would extend it to a gentile. If he is obligated to avoid avoda zara, he is obligated to do so even at the cost of his life. By contrast, if yeihareg ve-al ya'avor is based upon a separate mitzva of kiddush Hashem, a gentile may not be obligated in that separate mitzva. After all, he is only commanded to observe the seven mitzvot charged upon benei Noach, and he is therefore not included under the obligation of kiddush Hashem.