Immunity in vertebrates is well established to develop with time, but the ontogeny of defence in invertebrates is markedly less studied. Yet, age-specific capacity for defence against pathogens, coupled with age structure in populations, has widespread implications for disease spread. Thus, we sought to determine the susceptibility of hosts of different ages in an experimental invertebrate host-pathogen system. In a series of experiments, we show that the ability of Daphnia magna to resist its natural bacterial pathogen Pasteuria ramosa changes with host age. Clonal differences make it difficult to draw general conclusions, but the majority of observations indicate that resistance increases early in the life of D. magna, consistent with the idea that the defence system develops with time. Immediately following this, at about the time when a daphnid would be most heavily investing in reproduction, resistance tends to decline. Because many ecological factors influence the age structure of Daphnia populations, our results highlight a broad mechanism by which ecological context can affect disease epidemiology. We also show that a previously observed protective effect of restricted maternal food persists throughout the entire juvenile period, and that the protective effect of prior treatment with a small dose of the pathogen ('priming') persists for 7 days, observations that reinforce the idea that immunity in D. magna can change over time. Together, our experiments lead us to conclude that invertebrate defence capabilities have an ontogeny that merits consideration with respect to both their immune systems and the epidemic spread of infection.