Goal-directed behavior requires adaptive systems that respond to environmental demands. In the absence of threat (or presence of reward), individuals can explore many behavioral trajectories, effectively interrogating the environment across multiple dimensions. This leads to flexible, relational memory encoding and retrieval. In the presence of danger, motivation shifts to an imperative state characterized by a narrow focus of attention on threatening information. This impairs flexible, relational memory. We test how these motivational shifts affect behavioral flexibility in an ecologically valid setting. Participants learned the structure of maze-like environments and navigated to the location of objects in both safe and threatening contexts. The latter contained a predator that could ‘capture’ participants, leading to electric shock. After learning, the path to some objects was unpredictably blocked, forcing a detour for which one route was significantly shorter. We predicted that threat would push participants toward an imperative state, leading to less efficient and less flexible navigation. Threat caused participants to take longer paths to goal objects and less efficient detours when obstacles were encountered. Threat-related impairments in detour navigation persisted after controlling for non-detour navigation performance, and non-detour navigation was not a reliable predictor of detour navigation. This suggests a specific impairment in flexible navigation during detours, an impairment unlikely to be explained by more general processes like predator avoidance or divided attention that may be present during non-detour navigation. These results provide ecologically valid evidence that dynamic, observable threats reduce flexible use of cognitive maps to guide behavior.