The nuclear-recoil correction to the bound-electron g factor in H-like atoms is calculated to first order in m/M and to all orders in alphaZ. The calculation is performed in the range Z = 1--100. A large contribution of terms of order (alphaZ)(5) and higher is found. Even for hydrogen, the higher-order correction exceeds the (alphaZ)(4) term, while for uranium it is above the leading (alphaZ)(2) correction. As a result, one of the main sources of the theoretical uncertainty for the bound-electron g factor is eliminated.