We set up a formalism of endoscopy for metaplectic groups. By defining a suitable transfer factor, we prove an analogue of the Langlands–Shelstad transfer conjecture for orbital integrals over any local field of characteristic zero, as well as the fundamental lemma for units of the Hecke algebra in the unramified case. This generalizes prior work of Adams and Renard in the real case and serves as a first step in studying the Arthur–Selberg trace formula for metaplectic groups.