Why plagues kill the righteous with the wicked
Rav Huna said in the name of Rebbe: The generation of the flood was not blotted out until they wrote marriage contracts for homosexuals and animals. Rabbi Simlai said: Wherever you find sexual immorality, andarlamosya comes to the world and kills the good and the wicked. (Bereishis Rabba 26:5)
The italicized word refers to a heavenly judgment for indiscriminate death, typically in the form of plagues. This teaching appears in several places with minor variations. Sometimes the sin of idolatry is included.
Two fundamental issues need to be addressed:
1) A heavenly judgment that does not distinguish between the righteous and the wicked runs counter to our basic understanding of God's perfect judgment. Even though all Jews are responsible for one another, and we are judged as a society, every individual is judged according to his own actions. Even when the righteous suffer, it must be perfect judgment. This must be reconciled.
2) Why is it specifically the sins of sexual immorality and idolatry that trigger this indiscriminate plague?
The sins of sexual immorality and idolatry are frequently intertwined. Here are many examples of a striking connection between them:
Rav Yehuda taught in the name of Rav: The Jews knew that idolatry was nonsense, and they only worshipped idolatry to permit public immorality. (Sanhedrin 63B)
The daughters of Moav used seduction to convince Jewish men to engage in idolatry. (See Sanhedrin 106A)
Licentiousness was part of the sin of the golden calf. (Shemos 32:6, Rashi)
Sexual immorality was part of idolatrous cults, and holy prostitutes sanctified immorality. (Devarim 23:18)
Sexual immorality is frequently used as a metaphor for straying from Hashem through idol worship. (Mishlei and elsewhere)
One who separates from idolatry dies (due to the tremendous struggle and agony involved). The same applies to one who separates from a life of immorality. (Avoda Zara 17A)
Chazal were unwilling to allow the slightest compromise in these areas even to save a life. They prohibited a man dying from lovesickness to even speak with the object of his lustful desires from behind a fence (Sanhedrin 75A). They also prohibited receiving medical treatment from apostates lest one be ensnared by them. Rabbi Yishmael forbade his own nephew from receiving life-saving treatment from a notorious apostate, and blessed him for living and dying in purity rather than violating the spiritual safeguards of Chazal. (Avoda Zara 27B)
Chazal prayed for and were granted the opportunity to eliminate the yetzer hara for idolatry. They subsequently weakened but did not eliminate the yetzer hara for immorality, since sexual desire is necessary for procreation. (Yoma 69B)
Clearly the sins of sexual immorality and idolatry are inextricably linked. This gives us a clue for why they both trigger indiscriminate destruction of the righteous and the wicked.
At the core, both sins revolve around the rationalization of evil, blurring the distinction between good and evil, after which anything can be justified.
The Torah makes it quite clear that forbidden relationships, particularly homosexual relationships, are abominable and to be utterly rejected. Those who wish to engage in and normalize these behaviors come along and reframe them in positive terms. It is two people loving each other, exploring their sexuality, being true to their identities, spreading tolerance and being open-minded. That is what God wants most of all, they declare. God loves them despite what they do in fact, God loves them precisely for engaging in these behaviors, because that is what He wants of them.
This perverse ideology, which turns the Torah completely on its head, clouds the clear thinking and erodes the morality of even the righteous, who do not engage in these behaviors. It pervades all of society in overt and subtle ways, to the extent that the average person loses the ability to distinguish between good and bad, right and wrong in fact, he may even deny that there are such things. It's all relative, and everyone has their own truth.
The same is true of idolatry, which sanctifies the greatest spiritual corruption, and is often a portal to permit sexual immorality.
The punishment for these sins particularly when they are enshrined in law is andarlamosya, a plague that does not distinguish between the good and the bad. It is indeed measure for measure, as God's perfect justice always is. When a society loses its ability to distinguish between good and bad when a society no longer recognizes there are such things, and only God decides which is which then God unleashes a punishment that sweeps away the good with the bad. When those who abstain from the worst behaviors nevertheless enable them and support them, they are punished just the same, without distinctions being made.
It is surely no coincidence that the pandemic causing death and destruction in so many ways parallels a descent into moral depravity and corruption of God's most basic truths like no time in recent memory. While it is difficult to know with certainty the spiritual cause behind events, it behooves us to recognize that God is sending us messages precisely so we can try to understand them and react accordingly. It is not enough to simply pray more and try to be better people in vague, non-threatening ways. Big things are happening and everything is on the line. We need to have uncomfortable conversations about deep spiritual problems in our society and work hard to correct these problems.
People need to get over their feelings, and those with a propensity for being offended must not hold the rest of us hostage. If we want God to remove a plague that doesn't distinguish between the good and the wicked, we must allow God to define for us what is good and what is wicked, and reshape our society accordingly.
Only then will we merit the end of the indiscriminate punishments and become worthy of the indiscriminate blessings we desire.