Prey respond to predators by altering their behavior to optimize their own fitness and survival. Specifically, prey are known to avoid predator-occupied territories to reduce their risk of harm or injury to themselves and their progeny. We probe the interactions betweenCaenorhabditis elegansand its naturally cohabiting predatorPristionchus uniformisto reveal the pathways driving changes in prey behavior. WhileC. elegansprefers to lay its eggs on a bacteria food lawn, the presence of a predator inside a lawn inducesC. elegansto lay more eggs away from that lawn. We confirm that this change in egg laying is in response to bites from predators, rather than to predatory secretions. Moreover, predator-exposed prey continue to lay their eggs away from the dense lawn even after the predator is removed, indicating a form of learning. Next, we find that mutants in dopamine synthesis significantly reduce egg laying behavior off the lawn in both predator-free and predator-inhabited lawns, which we can rescue by transgenic complementation or supplementation with exogenous dopamine. Moreover, we find that dopamine is likely released from multiple dopaminergic neurons and requires combinations of both D1- (DOP-1) and D2-like (DOP-2 and DOP-3) dopamine receptors to alter predator-induced egg laying behavior, whereas other combinations modify baseline levels of egg laying behavior. Together, we show that dopamine signaling can alter both predator-free and predator-induced foraging strategies, suggesting a role for this pathway in defensive behaviors.