Innate immunity in Caenorhabditis elegans requires a conserved PMK-1 p38 mitogen-activated protein kinase (MAPK) pathway that regulates the basal and pathogen-induced expression of immune effectors. The mechanisms by which PMK-1 p38 MAPK regulates the transcriptional activation of the C. elegans immune response have not been identified. Furthermore, in mammalian systems the genetic analysis of physiological targets of p38 MAPK in immunity has been limited. Here, we show that C. elegans ATF-7, a member of the conserved cyclic AMP–responsive element binding (CREB)/activating transcription factor (ATF) family of basic-region leucine zipper (bZIP) transcription factors and an ortholog of mammalian ATF2/ATF7, has a pivotal role in the regulation of PMK-1–mediated innate immunity. Genetic analysis of loss-of-function alleles and a gain-of-function allele of atf-7, combined with expression analysis of PMK-1–regulated genes and biochemical characterization of the interaction between ATF-7 and PMK-1, suggest that ATF-7 functions as a repressor of PMK-1–regulated genes that undergoes a switch to an activator upon phosphorylation by PMK-1. Whereas loss-of-function mutations in atf-7 can restore basal expression of PMK-1–regulated genes observed in the pmk-1 null mutant, the induction of PMK-1–regulated genes by pathogenic Pseudomonas aeruginosa PA14 is abrogated. The switching modes of ATF-7 activity, from repressor to activator in response to activated PMK-1 p38 MAPK, are reminiscent of the mechanism of regulation mediated by the corresponding ancestral Sko1p and Hog1p proteins in the yeast response to osmotic stress. Our data point to the regulation of the ATF2/ATF7/CREB5 family of transcriptional regulators by p38 MAPK as an ancient conserved mechanism for the control of innate immunity in metazoans, and suggest that ATF2/ATF7 may function in a similar manner in the regulation of mammalian innate immunity.