The medical face mask as we know it today really got its start in the late 1800s. In the 1860s, germ theory of disease was starting to take off, and Joseph Lister proposed that wound infections were caused by bacteria and other germs. This kicked off the antiseptic movement where surgeons following Lister's example would attempt to sterilize a wound or surgical incision to prevent infection.
By the 1880s, surgeons, especially in Europe, started thinking to themselves, "Hey, wait. Wouldn't it be better to prevent the germs from entering in the first place?" Enter surgeon Johann Mikulicz and bacteriologist Carl Flugge, both of Breslau, Poland. Flugge showed experimentally that bacteria could be transmitted by respiratory droplets, and in 1897 Mikulicz in response devised a mask to wear during surgeries to prevent himself from unintentionally infecting patients. His design was just a bit of fabric tied with strings to his surgical cap. Other surgeons and physicians caught on and the practice slowly, slowly spread through surgical wards.
There were "anti-maskers" even then, with some physicians rolling their eyes and seeing the whole thing as unnecessary--much like they did with Ignaz Semmelweis and his insistence on handwashing only a few decades earlier.
Now, let's fast forward to Manchuria in 1910. Manchuria was a hotly contested territory with China, Russia, and Japan all laying claim to the region. It was, that year, also the epicenter of a massive and deadly plague outbreak. Thanks in no small part to photography, news of the outbreak was closely followed across the globe.
Dr. Wu Lien-teh, a Chinese-Malaysian doctor, was tapped the Chinese government to head up their response. He was... not exactly welcomed by the Russian, Japanese, and European teams.
Dr. Wu correctly identified the disease as pneumonic plague. The Black Death can take three main forms depending on where and how the bacteria infect the victim: bubonic (the most common, infecting the lymph nodes), septisemic (infecting the blood), and pneumonic (infecting the lungs). Pneumonic plague is extremely deadly and, as it is spread through respiratory droplets, highly contagious.
Dr. Wu suggested that to prevent spreading the plague, people should cover their face and mouths with fabric masks. He even tried out a few different designs to find which one would be the most effective and easiest to produce and wear. The design he settled on is basically identical to the generic medical mask seen today.
His suggestion did not win him friends among the international doctors. French doctor Gerald Mesny was openly hostile to Wu made a point of not wearing a mask. Mesny soon after contracted the plague and died. After that, Wu's masks caught on rapidly.
The 1918 Flu Pandemic spread Wu's mask across the world. Although after 1920, use in the general populace largely fell out of practice in the U.S. and Europe (until recent events).