LSM 900 is a confocal laser scanning microscope that uses laser light in a confocal beam path to capture defined optical sections of your sample and combine them in a three-dimensional image stack. Its aperture (usually called a pinhole) is arranged in such a way that out-of-focus information will be blocked and only in-focus information can be detected.

An image is generated by scanning in x,y-direction. In-focus information appears bright while out-of-focus information is dark.
By changing the distance between sample and objective lens, the sample is optically sectioned and an image stack is generated.
By analyzing the intensity distribution of a single pixel through the image stack you can calculate the corresponding height. The height information over the whole field of view can then be combined to form a height map.