Pore-forming toxins (PFTs) constitute the single largest class of proteinaceous bacterial virulence factors and are made by many of the most important bacterial pathogens. Host responses to these toxins are complex and poorly understood. We find that the endoplasmic reticulum unfolded protein response (UPR) is activated upon exposure to PFTs both in Caenorhabditis elegans and in mammalian cells. Activation of the UPR is protective in vivo against PFTs since animals that lack either the ire-1-xbp-1 or the atf-6 arms of the UPR are more sensitive to PFT than wild-type animals. The UPR acts directly in the cells targeted by the PFT. Loss of the UPR leads to a normal response against unrelated toxins or a pathogenic bacterium, indicating its PFT-protective role is specific. The p38 mitogen-activated protein (MAPK) kinase pathway has been previously shown to be important for cellular defenses against PFTs. We find here that the UPR is one of the key downstream targets of the p38 MAPK pathway in response to PFT since loss of a functional p38 MAPK pathway leads to a failure of PFT to properly activate the ire-1-xbp-1 arm of the UPR. The UPR-mediated activation and response to PFTs is distinct from the canonical UPR-mediated response to unfolded proteins both in terms of its activation and functional sensitivities. These data demonstrate that the UPR, a fundamental intracellular pathway, can operate in intrinsic cellular defenses against bacterial attack.