Microglia, the resident myeloid cells of the central nervous system, play important roles in life-long brain maintenance and in pathology. Despite their importance, their regulatory dynamics during brain development have not been fully elucidated. Using genome-wide chromatin and expression profiling coupled with single-cell transcriptomic analysis throughout development, we found that microglia undergo three temporal stages of development in synchrony with the brain–early, pre-, and adult microglia–which are under distinct regulatory circuits. Knockout of the gene encoding the adult microglia transcription factor MAFB and environmental perturbations, such as those affecting the microbiome or prenatal immune activation, led to disruption of developmental genes and immune response pathways. Together, our work identifies a stepwise microglia developmental program integrating immune response pathways that may be associated with several neurodevelopmental disorders.