The Shulhan Aruch (Orah Haim 328) speaks of a kind of bandage or tourniquet that was used with medicinal ointment. The ointment would be applied to the bandage, and the bandage would then be placed on the wound to help it heal. Halacha forbids replacing such a bandage if it fell off on Shabbat. Although medical procedures that were begun before Shabbat are generally permitted on Shabbat, in this instance the Sages forbade replacing the bandage out of concern that one may sear the ointment before replacing the bandage, in violation of Shabbat.
Hacham Ovadia Yosef addresses in light of this Halacha the situation of a person with a wound covered by a dressing smeared with ointment which the doctor instructed him to change each day, or several times a day, in order to prevent infection. In light of the concern of an infection, Hacham Ovadia permits the patient in this case to prepare bandages with the ointment before Shabbat and then putting them on the wound on Shabbat as per the doctor’s instructions. Although the Shulhan Aruch forbids placing such a bandage on Shabbat – and even replacing one which had been placed before Shabbat – nevertheless, there is room to permit changing the dressing when there is a risk of infection, as long as the ointment was applied to the dressing before Shabbat.
Summary: It is forbidden on Shabbat to apply ointment to a bandage, and if such a bandage had been placed on a wound before Shabbat, it is forbidden to replace it if it fell off, or to put on a new one. If, however, the bandage needs to be changed to prevent infection, one may prepare bandages with ointment before Shabbat and then replace his bandage on Shabbat as needed.