The effect of a magnetic field on the optical absorption in semiconductors has been measured experimentally and modeled theoretically for various systems in previous decades. We present a new first-principles approach to systematically determine the response of excitons to magnetic fields, i.e. exciton $g$ factors. By utilizing the $GW$-Bethe-Salpeter equation methodology we show that $g$ factors extracted from the Zeeman shift of electronic bands are strongly renormalized by many-body effects which we trace back to the extent of the excitons in reciprocal space. We apply our approach to monolayers of transition metal dichalcogenides (MoS$_2$, MoSe$_2$, MoTe$_2$, WS$_2$, and WSe$_2$) with strongly bound excitons for which $g$ factors are weakened by about 30%.