You can achieve this effect using the compositor by extracting the world position, splitting out the 'Z' coordinate and detecting where it crosses a repeating threshold.
First, we need to capture the world coordinate at every point in the scene. For this you can use the following material :
This takes the Object coordinate and converts it into World coordinates, returning the RGB color of the coordinate in world space. This will be used to extract the Height of any point in the scene.
If you need to render the scene normally as well as capture the contours you can use the Render Layer 'Material Override' setting to add a render layer specificaly for this.
In the compositor we now need to extract the 'height' information (the 'B' channel corresponding to 'Z'), split it into bands, and detect the edges. This can be achieved as follows :
The Modulo function is used to split the height into bands (the following Divide re-scales the result so it still spans the 0.0 to 1.0 range). This then passes to a simple edge-detection stage where the image is offset and compared (via Subtract) with a neighboring pixel. If the result of this indicate a large difference then it is deemed to be an 'edge'. By performing this comparison in each direction (once in X direction, once in Y direction, and both doubled up with Absolute) and combining the result we can detect the edge where the modulo jumps from Low to High.
Adjusting the Band, Thickness, Threshold Value nodes allows you to fine tune the banding.
This can produce the following result :
Blend file included
A similar setup can produce the same result from Blender Render. Here are the required material nodes :
Note the use of a Mapping node to shift the values in the Z direction. This is due to the limitation of Blender Render to not render values less than 0.0 - the negative values all become limited at 0.0. In my case, adding 500 moves all the coordinates in the scene to above 0.0.
Additional...
As for the dark areas shown in your supplementary image :
The issue is in how the edge detection is working with the values you have chosen for Threshold and Thickness. Try increasing the Thickness and/or lowering the Threshold until the banding disappears. The edge detection is very simplistic - it only looks for a single contrasting pixel in each direction, excluding diagonals. If the edge is very narrow it's easy for the edge detection to miss the edge - adjusting the settings should help... or a more capable edge detection algorithm - or even render at a higher resolution.
To answer your query regarding the Absolute maths node missing socket, the missing node is simply hidden for clarity since it is not used for Absolute operations. Unused sockets can be hidden by selecting the node and hitting Ctrl+H. The same action can be used to re-show hidden sockets.