The intestinal microbe Escherichia coli is subject to fecal deposition in secondary habitats, where it persists transiently, allowing for the opportunity to colonize new hosts. Selection in the secondary habitat can be postulated, but its impact on the genomic diversity of E. coli is unknown. Environmental selective pressure on extrahost E. coli can be revealed by landscape genetic analysis, which examines the influences of dispersal processes, landscape features, and the environment on the spatiotemporal distribution of genes in natural populations. We conducted multilocus sequence analysis of 353 E. coli isolates from soil and fecal samples obtained in a recreational meadow to examine the ecological processes controlling their distributions. Soil isolates, as a group, were not genetically distinct from fecal isolates, with only 0.8% of genetic variation and no fixed mutations attributed to the isolate source. Analysis of the landscape genetic structure of E. coli populations showed a patchy spatial structure consistent with patterns of fecal deposition. Controlling for the spatial pattern made it possible to detect environmental gradients of pH, moisture, and organic matter corresponding to the genetic structure of E. coli in soil. Ecological distinctions among E. coli subpopulations (i.e., E. coli reference collection [ECOR] groups) contributed to variation in subpopulation distributions. Therefore, while fecal deposition is the major predictor of E. coli distributions on the field scale, selection imposed by the soil environment has a significant impact on E. coli population structure and potentially amplifies the occasional introduction of stress-tolerant strains to new host individuals by transmission through water or food.