During long-distance migrations, animals navigate using a variety of sensory cues, mechanisms and strategies. Although guidance mechanisms are usually studied under controlled laboratory conditions, such methods seldom allow for navigation behavior to be examined in an environmental context. Similarly, although realistic environmental models are often used to investigate the ecological implications of animal movement, explicit consideration of navigation mechanisms in such models is rare. Here, we used an interdisciplinary approach in which we first conducted lab-based experiments to determine how hatchling loggerhead sea turtles (Caretta caretta) respond to magnetic fields that exist at five widely separated locations along their migratory route, and then studied the consequences of the observed behavior by simulating it within an ocean circulation model. Magnetic fields associated with two geographic regions that pose risks to young turtles (due to cold wintertime temperatures or potential displacement from the migratory route) elicited oriented swimming, whereas fields from three locations where surface currents and temperature pose no such risk did not. Additionally, at locations with fields that elicited oriented swimming, simulations indicate that the observed behavior greatly increases the likelihood of turtles advancing along the migratory pathway. Our findings suggest that the magnetic navigation behavior of sea turtles is intimately tied to their oceanic ecology and is shaped by a complex interplay between ocean circulation and geomagnetic dynamics.