It uses the pressure altitude relative to the sea level pressure you configure in the plane (the altimeter in inHg / QNH). Above transition altitude (in the US usually 18000) you switch to standard pressure (29.92 inHg), so for those higher flight levels we ignore pressure differences. But for altitudes below this, yes you constantly have to change the altimeter in the plane or else your altitude / flight level chance / VNAV descent / climb will be incorrect. Of course you can always get the pressure by tuning into a ATIS / AWOS etc radio station for a nearby airport if you aren't getting the latest pressure from the ATC enroute.
GPS is usually not used for altitude.