The endosymbiont Wolbachia infects a large number of insect species and is capable of rapid spread when introduced into a novel host population. The bacteria spread by manipulating their hosts' reproduction, and their dynamics are influenced by the demographic structure of the host population and patterns of contact between individuals. Reaction-diffusion models of the spatial spread of Wolbachia provide a simple analytical description of their spatial dynamics but do not account for significant details of host population dynamics. We develop a metapopulation model describing the spatial dynamics of Wolbachia in an age-structured host insect population regulated by juvenile density-dependent competition. The model produces similar dynamics to the reaction-diffusion model in the limiting case where the host's habitat quality is spatially homogeneous and Wolbachia has a small effect on host fitness. When habitat quality varies spatially, Wolbachia spread is usually much slower, and the conditions necessary for local invasion are strongly affected by immigration of insects from surrounding regions. Spread is most difficult when variation in habitat quality is spatially correlated. The results show that spatial variation in the density-dependent competition experienced by juvenile host insects can strongly affect the spread of Wolbachia infections, which is important to the use of Wolbachia to control insect vectors of human disease and other pests.