The reason is a glitch.
> The glitch is activated when Gravity is used while two Pokémon are in the semi-invulnerable state after Sky Drop is used. Gravity will bring the user of Sky Drop down while the target will be stuck in the semi-invulnerable state, unable to move until the user of Sky Drop is knocked out or switched out.
Source