When babies begin rolling their eyes in their sleep it's caused by what's known as REM.
Half the babies sleep is active rapid eye movement which is when they're dreaming so it's normal for a baby to sometimes roll their eyes when they're sleeping.
Also other movements such as twitching muscles during this stage is also normal along with the rolling of the babies eyes under their eyelid.
It's a very normal thing and some adults even do that or older kids when they're sleeping due to dreaming.