Groundwater is the world’s largest freshwater resource and is critically important for irrigation, and hence for global food security1,2,3. Already, unsustainable groundwater pumping exceeds recharge from precipitation and rivers4, leading to substantial drops in the levels of groundwater and losses of groundwater from its storage, especially in intensively irrigated regions5,6,7. When groundwater levels drop, discharges from groundwater to streams decline, reverse in direction or even stop completely, thereby decreasing streamflow, with potentially devastating effects on aquatic ecosystems. Here we link declines in the levels of groundwater that result from groundwater pumping to decreases in streamflow globally, and estimate where and when environmentally critical streamflows—which are required to maintain healthy ecosystems—will no longer be sustained. We estimate that, by 2050, environmental flow limits will be reached for approximately 42 to 79 per cent of the watersheds in which there is groundwater pumping worldwide, and that this will generally occur before substantial losses in groundwater storage are experienced. Only a small decline in groundwater level is needed to affect streamflow, making our estimates uncertain for streams near a transition to reversed groundwater discharge. However, for many areas, groundwater pumping rates are high and environmental flow limits are known to be severely exceeded. Compared to surface-water use, the effects of groundwater pumping are markedly delayed. Our results thus reveal the current and future environmental legacy of groundwater use.