Surviving infection requires immune and repair mechanisms. Developing organisms face the additional challenge of integrating these mechanisms with tightly controlled developmental processes. The larval Drosophila midgut lacks dedicated intestinal stem cells. We show that, upon infection, larvae perform limited repair using adult midgut precursors (AMPs). AMPs differentiate in response to damage to generate new enterocytes, transiently depleting their pool. Developmental delay allows for AMP reconstitution, ensuring the completion of metamorphosis. Notch signaling is required for the differentiation of AMPs into the encasing, niche-like peripheral cells (PCs), but not to differentiate PCs into enterocytes. Dpp (TGF-β) signaling is sufficient, but not necessary, to induce PC differentiation into enterocytes. Infection-induced JAK-STAT pathway is both required and sufficient for differentiation of AMPs and PCs into new enterocytes. Altogether, this work highlights the constraints imposed by development on an organism's response to infection and demonstrates the transient use of adult precursors for tissue repair.