A stereogram actually refers to a set of 2 2D images, one from the perspective of each eye. Which when viewed together through a machine called a stereoscope show a 3D image of the scene you’re looking at.
Magic eye pictures are a specific kind of stereogram called an autostereogram. This is because you don’t need a machine. What you need to do is ignore the usual cues you get from an image about ‘where’ to focus your eyes. This is why you have to cross your eyes to see it.