well if the school was on top of the hill and you lived at the bottom you would need to walk up hill no matter which way you took, I'm guessing there was only two roads going up the hill though?
that may be what was intended, but if so they should have written something like
"we used to walk 15 miles up hill, BOTH WAYS, just to get to school and back home", which approximates the way that joke is generally phrased, instead of "we used to walk 15 miles up hill, BOTH WAYS, just to get to school" ;)