They used inertial altitude on the X-15 for high altitude measurements. This works just like an IRS (Inertial Reference System), which was used on airliners of that era: you can get the position (latitude and longitude) based on a manually entered (or GPS derived) start position by integrating rotations and accelerations over time. The principle also works in 3D, if you also enter the start altitude. Note however that inertial altitude (true altitude above mean sea level) is not equal to barometric altitude, which can deviate based on local environmental conditions.
On the instrument panel was an attitude indicator whose source was inertially derived. Also provided were inertial velocity, altitude, and rate-of-climb. Barometric instruments included an altimeter and a combined Mach-airspeed indicator; these instruments were usable only below about 75,000 feet and were used mainly in the traffic pattern. An angle of attack and a sideslip indicator were provided; the source of these two instruments was selectable, inertial for high altitude flight and barometric for the end of the mission.
(NASA - Dryden History - X-15 Lessons Learned, emphasis mine)
You can see both instruments in the following image:
(modified from source)