Surgeons wear masks to protect themselves from the patient's bodily fluids, such as blood. The patients are pre-screened for viruses and diseases prior to their procedure.
They wear masks to prevent germs from transferring from the surgeon (or nurse) to the patient and causing infection. This is basic stuff I thought most people knew. :-)