You'll be shocked (I was), but they hardly do.
Guideline for the prevention of surgical site infection, 1999 (CDC):
1) the wearing of surgical masks is a tradition,
2) their efficacy is questionable,
3) but they may protect against splashes of blood and fluids.
They protect the wearer from splashes, that's the extent of their utility.
https://stacks.cdc.gov/view/cdc/7160
Ewww.