Question: May one ingest medicine on Shabbat?
Answer: The Talmud (Shabbat 140a) discusses a person who took medicine on Thursday and Friday and, on Shabbat, wanted to dissolve and drink his medicine. The Talmud rules that since he had taken the medicine on Thursday and Friday, he can dissolve and drink it on Shabbat since his life would be in danger otherwise. The Gemara is obviously implying that the only reason this action is permitted is because the person’s life is in danger.
HaGaon HaRav R. Yosef Shalom Elyashav noted that the Gemara’s case clearly involves medicine that needs preparing. In such a case, one may prepare and take the medicine only if the situation is critical. Taking pills on Shabbat, however, is another matter. A person need not do anything to the pills themselves.
If, therefore, he already had started taking the medicine before Shabbat, he should arguably be allowed to take the pills even if his life is not in danger. In other words, perhaps, the rabbis never imposed a prohibition in such a case. (See Kovetz Teshuvot, siman 40, ruling cited in the name of HaRav Shlomo Kluger, Sefer HaChaim 328:10.)
Thus, those in need would be permitted to take their medicine on Shabbat provided they had already started taking it before Shabbat.