As OSM itself does not contain any height data, the terrain contour lines you’re seeing on some OSM maps are generally produced from third-party datasets such as SRTM.

You could look at OpenDEM, which collects various elevation datasets.