The Compass app shows the direction your Apple Watch is facing, your current location, and elevation.
support.apple.com
The altitude is determined by a combination of GPS (and possibly other positioning information) and barometric pressure changes. The GPS sets the baseline, and the barometer detects the variation more accurately than GPS can.
Note that it is often not very accurate, especially if GPS reception is poor (like inside a building). Altitude is the least accurate positioning provided by GPS, and its accuracy is very variable. Lower your expectations.