We investigate the cosmic evolution of the internal structure of massive early-type galaxies over half of the age of the Universe. We perform a joint lensing and stellar dynamics analysis of a sample of 81 strong lenses from the SL2S and SLACS surveys and combine the results with a hierarchical Bayesian inference method to measure the distribution of dark matter mass and stellar IMF across the population of massive early-type galaxies. Lensing selection effects are taken into account. We find that the dark matter mass projected within the inner 5 kpc increases for increasing redshift, decreases for increasing stellar mass density, but is roughly constant along the evolutionary tracks of early-type galaxies. The average dark matter slope is consistent with that of an NFW profile, but is not well constrained. The stellar IMF normalization is close to a Salpeter IMF at $log{M_*} = 11.5$ and scales strongly with increasing stellar mass. No dependence of the IMF on redshift or stellar mass density is detected. The anti-correlation between dark matter mass and stellar mass density supports the idea of mergers being more frequent in more massive dark matter halos.