We examine variations of the stellar initial mass function (IMF) in extreme environments within the formalism derived by Hennebelle & Chabrier. We focus on conditions encountered in progenitors of massive early type galaxies and starburst regions. We show that, when applying the concept of turbulent Jeans mass as the characteristic mass for fragmentation in a turbulent medium, instead of the standard thermal Jeans mass for purely gravitational fragmentation, the peak of the IMF in such environments is shifted towards smaller masses, leading to a bottom-heavy IMF, as suggested by various observations. In very dense and turbulent environments, we predict that the high-mass tail of the IMF can become even steeper than the standard Salpeter IMF, with a limit for the power law exponent $alphasimeq -2.7$, in agreement with recent observational determinations. This steepening is a direct consequence of the high densities and Mach values in such regions but also of the time dependence of the fragmentation process, as incorporated in the Hennebelle-Chabrier theory. We provide analytical parametrizations of these IMFs in such environments, to be used in galaxy evolution calculations. We also calculate the star formation rates and the mass-to-light ratios expected under such extreme conditions and show that they agree well with the values inferred in starburst environments and massive high-redshift galaxies. This reinforces the paradigm of star formation as being a universal process, i.e. the direct outcome of gravitationally unstable fluctuations in a density field initially generated by large scale shock-dominated turbulence. This globally enables us to infer the variations of the stellar IMF and related properties for atypical galactic conditions.