The built-in altimeter uses a pressure sensor to measure the current air pressure.
The measured air pressure is then used to provide an "estimate" of the current altitude.
The electronic mechanism in the watch is pre-programmed with "ISA values" ("International Standard Atmosphere") used to convert pressure values into altitude values.
The air pressure and temperature generally become lower as the altitude increases.
These values define the connection between altitude, air pressure and temperature.