Is one allowed to take medicine on shabbas to help prevent something? Can one for example take tums before eating a meal because he knows he will get heartburn after?
The topic of preventative medicine on Shabbos is explained in "The 39 Melochos Book" by Rabbi Dovid Ribiat (vol. 2 pg. 483). He explains that the reason the Sages forbade medicine on Shabbos is because of the concern that the anxiety due to his situation may lead him to desecrate Shabbos. This therefore only applies when one is presently suffering from an ailment. Preventative therapy however is permitted in general on Shabbos even with the use of medication. Examples of this include:
- Taking an antacid before eating to prevent heartburn.
- Taking a tablet to prevent the onset of a migraine
- Diabetic, ashtma or other chronic medication
Regarding vitamins he brings an argument amongst contemporary Halachic authorities. Some (Igress Moshe OC 3:54) forbid it if has the end result of strengthning his body (and not just preventing illness) while others permit (Shmiras Shabbos Kehilchoso 34:18 footnote 76-77).
R' Shlomo Zalman Auerbach (Nishmas Avraham 1:164) held that one with a a mild headache may take an aspirin if this will avoid his developing a more severe headache. One doesn't need to wait until he is very sick to take the medicine. R' Yehoshua Neuwirth (Shemiras Shabbos Kehilchasa 34:16) concurs.
In addition, it would seem that tums are muttar to take anyway as it may come under the category of מאכל בריאים- food that is taken by otherwise healthy people. (See Mishna on Shabbos 109b)