In humans, the rolling of the eyes upward is associated with deep relaxation and trance states. When alertness is required we bring our eyes frontward, which allows us to orient ourselves using visual clues. But in deeply relaxed states, we feel secure and allow ourselves to let go of that impulse to keep oriented; the eyes naturally roll back.
There is a curious correlation between eye position and brain wave activity. The rolled-back eye position seems to go along with hypnotic trance states, for instance. People who have difficulty rolling the eyes back are usually nearly impossible to hypnotize, and some people are so easy to hypnotize that simply rolling the eyes back can put them in a trance.