Our Gemara on Amud Aleph discusses a scenario where it is necessary to slaughter an animal to feed an ill person on Yom Kippur. In this scenario, the Gemara assumes there is no other meat available, and thus the mother goat of the scapegoat needs to be slaughtered for this purpose. This then raises the problem of the scapegoat being מחוסר זמן invalid due to a time dependent disqualification. In this case the prohibition of slaughtering the mother goat and the child goat on the same day, would make the scapegoat temporarily invalid for the service.
According to halakha, if someone needs to eat meat on Yom Kippur or even a regular Shabbos, and there is the option of available non-kosher meat or the option to slaughter an animal and prepare kosher meat, you have a basic dilemma. What is better, to avoid violating the Shabbos by eating the available non-kosher meat, or is it better to slaughter the animal and violate the shabbos, thereby committing one momentary sin, and avoiding the continuous sin of consuming each and every kzayis of non-kosher meat?
Logic would dictate that since everything is permitted in order to preserve life, why not just feed the person the non-kosher meat. What reason would justify an additional prohibition of slaughtering on shabbos? Yet Shulkhan Arukh (שו״ע או״ח שכח:יד ) rules that it is preferable to slaughter the animal and violate the Shabbos instead of feeding him non-kosher meat, unless of course the urgency is so strong that the a person who needs to eat right now and cannot even wait for the prep time it takes for the kosher slaughter.
Let us understand the basis for this ruling: Mishna Berura (39, also see Beis Yosef 13 for more detail) summarizes the various reasons as to why slaughtering on shabbos to feed the person kosher meat is preferable than feeding him available non-kosher meat:
Possible exceptions to these rules can occur if the ill person is sure that he will not feel disgusted by the non-kosher meat. Or, if the ill person is a minor under bar or bat mitzvah. Since the minor is not obligated in the prohibition of non-kosher food, there is no rationale for a fully obligated Jew to violate shabbos and slaughter an animal to prevent the child from eating non-kosher.
The most psychologically interesting feature of this discussion is reason number three. I suspect this comes up more often than we realize. How often might we refuse to follow medical advice because it feels wrong to miss out on a mitzvah or transgress, even if it is vital for health.
How painful it is to not be able to fast on Yom Kippur, or how difficult it must be to not wear tefilin if your digestive system is unstable. The urge is to ignore the health concerns and just follow the ritual anyway. However, in doing so, we comfort ourselves with external compliance, which can have nothing to do with internal states. It can be a holier Yom Kippur to eat to save your life, than the longest most difficult fast. But it is always hard to feel that way at the time. It is easy to turn a mitzvah into an aveirah.
Translations Courtesy of Sefaria