By flicking back and forth between the two images, it creates the illusion of parallax - the apparent shift in the relative position of objects caused by changing your viewpoint. Parallax between the slightly differing viewpoints of your right and left eye allows the brain to perceive depth, giving you a three-dimensional view of the world.
The picture effectively provides a "left eye" viewpoint and "right eye" viewpoint in the same space. The brain gets both sets of information it needs and interprets this artificial parallax as depth - so you get an apparent 3D picture. Clever stuff.