Hacham Ovadia Yosef ruled that a diabetic who needs an insulin injection on Shabbat may inject the insulin, as such a patient is treated as a “Holeh She’yesh Bo Sakana” – somebody in a potentially life-threatening condition. Preferably, Hacham Ovadia writes, the insulin should be injected into a muscle, as opposed to a vein. Injections in veins cause bleeding, and so in the interest in minimizing the extent of Shabbat violation, it is preferable to make the injection into a muscle. However, if this is not possible, the insulin may be injected into a vein. This is also the ruling of Hacham Bension Abba Shaul (Israel, 1924-1998), in his work Or Le’sion. However, whereas Hacham Ovadia allows even preparing the injections on Shabbat, Hacham Bension Abba maintains that the injections should be prepared before Shabbat. (Hacham Ovadia’s discussion appears in Yehaveh Da’at 2:56, and in Yabia Omer, vol. 9, Orah Haim 108:187.)
Hacham Ovadia also writes that if a patient needs a nebulizer to help with breathing on Shabbat, the machine should be set up before Shabbat. However, if, for whatever reason, the machine was not set up before Shabbat, or if it was turned off or unplugged on Shabbat, then it may be set up or plugged in on Shabbat, despite the Shabbat violations entailed, given the potential risk to the patient’s life if he or she is unable to breathe properly. Likewise, if the water in the machine runs out on Shabbat, one may add water, even if the water will be heated. In such a case, Hacham Ovadia writes, it is preferable to use water that had already been heated previously. The Rambam (Rabbi Moshe Maimonides, Spain-Egypt, 1135-1204) maintained that “En Bishul Ahar Bishul Be’lah” – meaning, the Shabbat prohibition against cooking does not apply to something that had been previously cooked, even a liquid that had been boiled and has since cooled. Thus, in the interest of minimizing Shabbat desecration, it is preferable to pour into the nebulizer water that was previously heated, as this would not constitute a Shabbat violation according to the view of the Rambam.
One example of this Halacha is the situation of a patient suffering from croup who needs a vapor machine to breathe properly. It would be entirely permissible to turn on the hot water to create the vapor to help the patient breathe.
Summary: A diabetic may take insulin injections on Shabbat if necessary, though the injections should preferably be made in a muscle, instead of in a vein, to avoid bleeding. The injections may be prepared on Shabbat. If a patient needs a nebulizer in order to breathe properly, the machine should be set up before Shabbat. If, however, the machine was not set up before Shabbat, or if it ran out of water before Shabbat, one may turn it on or add water if the patient needs the machine. Preferably, one should use water that had already been boiled previously.