It is a really good question, my answer would be you maintain level flight in relation to the horizon when hand flying visually. When flying off instruments you do it by using an artificial horizon. But you are constantly making adjustments based on (normally) an altimeter that measures air pressure. Since the air pressure essentially follows the curve of the earth that is how you do it, with constant minor corrections. Big corrections using the horizon and then little corrections cross referencing the altimeter. An autopilot uses air pressure (and lots of other things). Air pressure works off of gravity so it follows the earth.