In response to surging immigration pressure in Europe and the United States, Western policymakers advocate foreign aid as a means to fight the 'root causes' of irregular migration. This article provides the first global evidence of the effects of aid on migration preferences, migration flows, and possible underlying mechanisms, both in the short and longer term. We combine newly geocoded data on World Bank aid project allocation at the subnational level over the period 2008-2019 with exceptionally rich survey data from a sample of almost one million individuals across the entire developing world and data on migration and asylum seeker flows to high-income countries. Employing two distinct causal estimation strategies, we show that in the short term (after the announcement of a World Bank project and within two years after project disbursement), foreign aid improves individual expectations about the future and trust in national institutions in aid-receiving regions, which translate into reduced individual migration preferences and asylum-seeker flows. In the longer term (between three to five years after disbursement), foreign aid fosters improvements in individual welfare through poverty reduction and income increases, resulting in larger regular migration to high-income countries. Our findings show that aid can cause a short-lived reduction in migration aspirations, except in fragile Sub-Saharan African contexts where aid appears largely ineffective. In contrast, foreign aid enhances individual capabilities over the longer term, contributing to greater regular migration, consistent with the 'mobility transition' theory.