The spectrum of topological modular forms is constructed as the global sections of a sheaf of E-infinity ring spectra on the moduli stack of (generalized) elliptic curves.
The original construction of tmf uses the obstruction theory of Hopkins, Miller, and Paul Goerss, and is based on ideas of Dwyer, Kan, and Stover.
In this approach, one defines a presheaf Otop ("top" stands for topological) of multiplicative cohomology theories on the etale site of the moduli stack of elliptic curves and shows that this can be lifted in an essentially unique way to a sheaf of E-infinity ring spectra.
A second construction, due to Jacob Lurie, constructs tmf rather by describing the moduli problem it represents and applying general representability theory to then show existence: just as the moduli stack of elliptic curves represents the functor that assigns to a ring the category of elliptic curves over it, the stack together with the sheaf of E-infinity ring spectra represents the functor that assigns to an E-infinity ring its category of oriented derived elliptic curves, appropriately interpreted.
Graeme Segal first proposed in the 1980s to provide a geometric construction of elliptic cohomology (the precursor to tmf) as some kind of moduli space of conformal field theories, and these ideas have been continued and expanded by Stephan Stolz and Peter Teichner.
In work more directly motivated by string theory, Edward Witten introduced the Witten genus, a homomorphism from the string bordism ring to the ring of modular forms, using equivariant index theory on a formal neighborhood of the trivial locus in the loop space of a manifold.
By work of Hopkins, Matthew Ando, Charles Rezk and Neil Strickland, the Witten genus can be lifted to topology.
The orientation of tmf is in analogy with the Atiyah–Bott–Shapiro map from the spin bordism spectrum to classical K-theory, which is a lift of the Dirac equation to topology.