Before vaccines were developed some contagious diseases were controlled by innoculation with the actual disease at a stage it was observed to generally be less harmful and fatal. A needle or scalpel would be used to transfer the infected material to the person innoculated.
George Washington employed this in a rolling mass innoculation for the Continental Army begining in February 1777.