These devices operate on the straightforward principle that atmospheric pressure varies inversely with elevation.
Its use in practice (Determination of Altitude with the Aneroid Barometer, Iowa Academy of Science, 1953): https://scholarworks.uni.edu/cgi/viewcontent.cgi?article=3169&context=pias
A similar unit at the Smithsonian: https://americanhistory.si.edu/collections/search/object/nmah_1420464