Energy has different vibrations which scientifically are referred to as wavelengths and frequencies. Base energy has more dense and lower vibration (longer wavelengths and lower frequencies), and they always sink to the bottom of the energy spectrum.
While good karma will bring about more refine energy, vice versus bad karmic deeds will cause the energy to be denser and less refined. Maybe that is one possible reason why hell is said to be the underworld and is below our earth, though I interpret it as in the energy realm with the lower and base vibrations as compared against the upper spiritual realms. That is the possible explanation of the law of gravity coming into play with regards to karma.