The effective g factor of holes is measured in modulation-doped ZnSe/(Zn,Mg)(S,Se) quantum wells and from surface-state p-doped CdTe/(Cd,Mg)Te quantum wells by time-resolved pump-probe Kerr rotation. The measurements are performed at a temperature of 1.7 K and in magnetic fields up to 5 T applied in the Voigt geometry with orientation perpendicular to the quantum-well growth axis. The absolute value of the in-plane hole g factor increases with growing magnetic field in both studied heterostructures. A theoretical model is developed that considers the influence of magnetic field and interface mixing of heavy-hole and light-hole states on the g factor. The model results are in good agreement with the experimental data.