The Shulchan Aruch (Orach Chayim 328) discusses the prohibition enacted by the Rabbis forbidding taking medication on Shabbat under certain circumstances. The Rabbis enacted this measure out of concern that one might grind herbs on Shabbat to produce medication, in violation of the prohibition against grinding on Shabbat. It should be recalled that in Talmudic times, medications were not purchased in capsule or tablet form as they are today; each patient would produce his own medication by grinding herbs. The Sages therefore forbade taking medication on Shabbat, as a safeguard against the prohibition of grinding.
May one eat on Shabbat regular foods, such as vegetables, for medicinal purposes? For example, if a physician tells a patient that partaking of certain foods will help alleviate his symptoms or recover from his illness, is it permissible for him to eat these foods on Shabbat?
Halacha establishes that foods normally eaten by healthy people were not included under the Rabbinic decree forbidding medication on Shabbat. Hence, one may eat any regular food on Shabbat even if he does solely for medicinal purposes.
Conversely, is it permissible for a perfectly healthy person to take medications on Shabbat?
The Beit Yosef (commentary on the Tur by Rabbi Yosef Karo, author of the Shulchan Aruch) establishes a rule that the prohibition against taking medications on Shabbat was from the outset applied only to those who are ill. Healthy people were never included under this prohibition, and thus a healthy person may take medication on Shabbat, even medications that are normally ingested only by sick patients.
This ruling of the Beit Yosef affects the question of taking vitamins on Shabbat. People take vitamins not to cure an illness, but rather to strengthen their body and help maintain good health. According to the Beit Yosef, a healthy person would be allowed to take vitamins on Shabbat, since the prohibition against taking medication applies only to those who are ill. Furthermore, today vitamins are considered food of healthy people, since many people who are healthy do take vitamins daily. This is indeed the ruling of several recent and contemporary authorities, including Chacham Ovadia Yosef, in his work Halichot Olam (vol. 4), Rabbi Moshe Feinstein (Russia-New York, 1895-1986), in Iggerot Moshe, and Chacham Bentzion Abba Shaul, Jerusalem, 1924-1998), in Or Le'tziyon.
Although Rabbi Shlomo Zalman Auerbach (Jerusalem, 1910-1995) disagreed, and forbade taking vitamins on Shabbat, in light of the rule established by the Beit Yosef and the position taken by the authorities mentioned earlier, it emerges that one may take vitamins on Shabbat.
Summary: The Rabbis forbade taking medication under certain circumstances on Shabbat. Ordinary food, however, may be eaten even for purely medicinal purposes, and a healthy person may take medications such as vitamins on Shabbat.