You could try summing distances over each pair of successive points in your path (sample it if needed), taking into account the average elevation as a radius in the great circle distance calculation.
See top answer there about taking elevation into account for distance between 2 points http://stackoverflow.com/questions/1108965/taking-altitude-into-account-when-calculating-geodesic-distance