From my understanding Jewish law not only permits, but requires Jews to violate most commandments (incluidng kosher laws) in life-threatening situations:
The Babylonian Talmud, Chapter 82a of Tractate Yoma mentions pregnancy cravings for non-kosher food (the passage discusses a pregnant woman who craves pork on Yom Kippur) as the paradigmatic example of a presumed life-threatening situation where a person is allowed to eat non-kosher food (and is permitted to eat it on Yom Kippur).
In this view, the martyrs would have been forbidden to resist the king’s decree merely to avoid eating pork. However there are a few exceptions to the aforementioned principle:
There is a famous example that can be found in the Babylonian Talmud Gittin 57b, the apocryphal II Maccabees 7, and other sources about Hannah and her seven sons, a story associated with the holiday of Hanukkah. Rather than eat pork, Hannah defies King Antiochus IV and allows her sons to be killed one by one before she herself dies.
However this story relates another exception where Halakha requires that one surrender their life. A situation where a person is forced to break a law simply for the sake of desecrating the Torah. If a non-Jewish ruler demands that a Jew cook food for him on the Sabbath, the Jew is required to desecrate the Sabbath rather than let himself be killed. However if the ruler demands the Jew cook food on the Sabbath, not for the ruler’s benefit but simply for the sake of dishonoring the Torah, then one is required to surrender their life to avoid desecrating God’s name (akin to idolatry). Hannah and her sons acted in this way when it came it eating pork for the sake of desecrating the Torah, by allowing themselves to be killed they sanctified God’s name in public.