Saint Sebastian was a Roman nobleman in Gaul and Milan during the third century. He became an "officer of the bodyguard for the emperor Diocletian He had healing powers and it is said that he used his office to help protect persecuted Christians. After a certain knight, named Cromatius, smashed his collection of idols, Sebastian healed the knight of a serious illness. The emperor Diocletian, who is well known for persecuting Christians, learned all the Sebastian was doing, Diocletian ordered some Numidian archers to tie Diocletian to a tree and kill him with bow and arrow. That order was followed and Sebastian was shot with arrows. He, unknown to the bowmen, survived the execution and was nursed back to health by a family friend. That friend warned Sebastian to stay away from Diocletian, but Sebastian showed himself to the emperor to explain the folly of continuing the persecutions. This time, Diocletian ordered that he be beaten to death with clubs and thrown in the river.
Going back to the ancient Greek world: the god Apollo was usually a benevolent god. He, at times, was called "Alexicacus" which means "averter of ills." However, he was also spread epidemics. This he did with the use of his arrows, which, like his sister Artemis/Diana, he was a sure-shot. So, diseases were spread by arrows.
During the time of the Black Death in Europe, the 14th century, many explanations were given for the cause of the plague. Most included sin and retribution; but some thought that the plague came from "the arrows of Apollo."
A connection was then made. If Sebastian has survived the onslaught of arrows, then perhaps if his name was invoked, he could protect supplicants who called upon him. Since then paintings of Sebastian were placed in churches where the faithful could use the image of the saint as an aid in their prayers. As early as 680, during a plague in Rome, Sebastian became a plague saint (along with 13 other "Holy Helpers").
The Medieval plague lasted more than 300 years in Europe and even in the early 17th century, Jesuits would sell metal arrows that could, supposedly, protect from the plague. Miraculous wine in which arrows were dipped had the same effect.
Saint Sebastian day is January 20th. And on that day cattle must fast to remain immune from diseases.
In summary, because Sebastian survived an execution of arrows, and because plagues were delivered to man in the form of arrows, Sebastian's name was invoked to protect the faithful from the plague, he became the patron saint of the black death. He is also the patron saint of archers, cattle, soldiers, hunters, invalids of war, sickly children, the dying, and more occupations dealing with soldiering and smithing.