Despite modern antiseptic techniques, surgical site infection (SSI) remains a leading complication of surgery. However, the origins of SSI and the high rates of antimicrobial resistance observed in these infections are poorly understood. Using instrumented spine surgery as a model of clean (class I) skin incision, we prospectively sampled preoperative microbiomes and postoperative SSI isolates in a cohort of 204 patients. Combining multiple forms of genomic analysis, we correlated the identity, anatomic distribution, and antimicrobial resistance profiles of SSI pathogens with those of preoperative strains obtained from the patient skin microbiome. We found that 86% of SSIs, comprising a broad range of bacterial species, originated endogenously from preoperative strains, with no evidence of common source infection among a superset of 1610 patients. Most SSI isolates (59%) were resistant to the prophylactic antibiotic administered during surgery, and their resistance phenotypes correlated with the patient’s preoperative resistome (
P
= 0.0002). These findings indicate the need for SSI prevention strategies tailored to the preoperative microbiome and resistome present in individual patients.