The Defending Pokémon can't retreat during your opponent's next turn.
It never sleeps. It has to keep moving because if it stopped, its magma body would cool and harden.