Buddhist teachings speak extensively of the six realms into which sentient beings are reborn (gods, demigods, humans, animals, ghosts, and hell beings). Like all other perceptions, the six realms are internal mental representations, made to arise by the accumulated karma (impressions, experiences, beliefs, and dispositions) of sentient beings.
The six realms are not truly established, substantial realities, in the sense that they are impermanent and dependent on causes and conditions. And yet, they appear in great detail to those that experience them. They are mental states, distortions of clear View, and nothing more. But just because they are internal mental representations, they are not absolutely non-existent. As long as we lack realization of emptiness, such perceptions appear and are experienced as reality. Although the six realms do not exist in an objective way, sentient beings experience subjective suffering in them.
Rebirth in the realms is not punitive. It is merely the natural consequence of afflicted emotions and unskillful acts. The hell realms are the farthest removed from enlightenment, in the direction of aversion, just as the god realms are farthest in the direction of attachment. The demigod realm distances us from enlightenment through jealousy, the human realm through desire, the animal realm through stupidity, and the ghost realm through greed.