The observed mass distribution of stars can be understood as the effect of supersonic turbulence in present-day star forming environments. I will present results of numerical simulations of supersonic turbulence that have allowed us to quantify universal statistical properties of supersonic turbulence. These properties can then be used to derive a statistical model for the origin of stellar mass distribution as a function of turbulent rms velocity, mean gas density, temperature and magnetic field strength. The model predicts the existence of a critical magnetic field strength below which the slope of the power law range of the stellar IMF becomes very steep. This suggests that the IMF of population III or early population II stars may be much steeper than a Salpeter IMF, though probably shifted to a larger mean mass, of order 10 solar masses. I will then present results from the largest simulations of supersonic turbulence to date, confirming the validity of the predictions of the simple statistical model for the origin of the IMF.