By combining insights from black holes and string theory we argue for the existence of a hidden phase space associated with an underlying fast dynamical system, which is largely invisible from a macroscopic point of view. The dynamical system is influenced by slow macroscopic observables, such as positions of objects. This leads to a collection of reaction forces, whose leading order Born Oppenheimer force is determined by the general principle that the phase space volume of the underlying system is preserved. We propose that this adiabatic force is responsible for inertia and gravity. This fact allows us to calculate the hidden phase space volume from the known laws of inertia and gravity. We find that in a cosmological setting the appearance of dark energy is naturally explained by the finite temperature of the underlying system. The adiabatic approximation that leads to the usual laws of inertia and gravity breaks down in the neighborhood of horizons. In this regime the reaction force degenerates into an entropic force, and the laws of inertia and gravity receive corrections due to thermal effects. A simple estimate of these effects leads to the conclusion that they coincide with observed phenomena attributed to dark matter.