Even when the circumstances are not life-threatening (neither for the choleh nor for others), but the medication/immunization would prevent illness (choli she'eyn bo sakana), non-kosher medication may be taken if there are no kosher alternatives, provided that it is shelo k'derech achila (not in the manner of eating; e.g. swallowing pills).
From the Star-K:
If a person is healthy or has a slight discomfort and his physician advises that there is a high risk of him becoming a choleh sheyaish bo sakana or even a choleh she’ain bo sakana, this person may take non-kosher supplements shelo k’derech achila, in an uncommon manner. For example, if a doctor advises HRT9 to a middle-aged woman to avoid osteoporosis, a common condition in older women, she may swallow a non-kosher capsule or tablet if an equally effective kosher substitute is unavailable. Similarly, if a doctor advises swallowing a specially formulated non-kosher vitamin for someone who has a high risk of developing macular degeneration (a disease in the central part of the retina that leads to blindness), one is permitted to swallow the product. However, if a healthy individual wishes to take non-kosher supplements to prevent an illness which is unlikely to occur, a Rav should be consulted, since the halacha is similar to one who has a maychush.
If you are asking where there is an oppressive government that demands eating e.g. pork as a vaccine to a minor discomfort (maychush), if their intention is not specifically to challenge Jewish law (such that we would invoke the rules of shmad), we would presumably allow the consumption of non-kosher to avoid children being prevented from learning Torah. This can be inferred from the fact that historically many Rabbis have risked their lives to teach and learn Torah, combined with the fact that one is not allowed to give up one's life to avoid eating non-Kosher (assuming the intent was not religious coercion; i.e. Torah>life>kosher).
Edit: On second thought, that only proves one could risk eating non-kosher in order to learn/teach Torah...