Migration has long been considered one of the key mechanisms through which labor markets adjust to economic shocks. In this paper, we analyze the migration response of American workers to two of the most important shocks that hit US manufacturing since the late 1990s - Chinese import competition and the introduction of industrial robots. Exploiting plausibly exogenous variation in exposure across US local labor markets over time, we show that robots caused a sizable reduction in population size, while Chinese imports did not. We rationalize these results in two steps. First, we provide evidence that negative employment spillovers outside manufacturing, caused by robots but not by Chinese imports, are an important mechanism for the different migration responses triggered by the two shocks. Next, we present a model where workers are geographically mobile and compete with either machines or foreign labor in the completion of tasks. The model highlights that two key dimensions along which the shocks differ - the cost savings they provide and the degree of complementarity between directly and indirectly exposed industries - can explain their disparate employment effects outside manufacturing and, in turn, the differential migration response.