If a person’s flesh is cut on Shabbat by a piece of metal, and the metal has rust, such that there is concern of an infection, he should do whatever is necessary to receive a tetanus shot, even if this entails Shabbat desecration. Given the potentially fatal risk, the person should be driven on Shabbat to a doctor or hospital to receive a shot. Even if this individual suffers no internal pain, he must violate Shabbat to receive a shot if there is a concern of an infection due to the penetration of rusty metal through his skin.
The Shulhan Aruch rules that one who on Shabbat was bitten by a rabid dog, or who mistakenly swallowed a leech, may violate Shabbat for the sake of seeking treatment, given the potential risk to his life. The modern-day equivalents of these situations would be cases of children who mistakenly ingested pills, sharp objects such as a needle, or toxic substances. All these cases are potentially life-threatening situations which require immediate medical attention, even if this entails Shabbat desecration, and thus the patient in all these cases must be driven on Shabbat to a doctor or hospital to be treated.
(Based on Yalkut Yosef – Shabbat, vol. 4, p. 225)