Do autopilot headings consider the earth's shape?
Yes, almost all modern computer navigation systems take this into account.

The track between two points along the "spherical" earth is called the great-circle track. Except for a N/S heading (or a E/W heading at the equator), the heading will vary along the track. Ed Williams has compiled a formulary for great circle navigation here, mostly derived from the Haversine formula. The formula you are interested in is "Course between points" for calculating the initial heading to fly from point A to point B.