I identify quasi-exogenous variation in the introduction of mobility restrictions in the West Bank during the Second Intifada (2000-2006) to study the distribution of residents, jobs and firms in response to changes in the commuters' market access. A village experiencing a loss in market access equivalent to a 10% increase in travel time towards all destinations on average suffered a loss of 0.3% in residents. However, it also experienced an increase of 0.3% in jobs, with the effect being particularly strong in wholesale and retail trade. The decrease in residents and the increase in jobs is reconciled with a decline in commuting of residents working outside the village. In a model of commuting, the sign of the effect of changes in commuting costs on residents and jobs depends on the initial direction of the commuting flows and the spatial sorting in the city.