Suppose we reformulate the problem as follows. I apologize for the mathematical jargon; the essential idea is that we are to consider the set of legal positions for the two hikers, and show that the initial position is reachable from the position with the hikers reversed. We do this by showing, in a precise sense, that nothing disconnects them.
To start out, let us make a definition:
Let $f:[0,1]\rightarrow \mathbb [0,\infty)$ be a continuous* function with $f(0)=f(1)=0$, representing the height of the mountain range a given distance from the left. Assume that the hikers begin at $0$ and $1$ respectively. Next, let $S=[0,1]\times[0,1]$ be the unit square, which is the set of tuples $(x,y)$ of possible positions of the hikers. Define the difference in height $g$ as:
Note that the legal positions are exactly those for which $g(x,y)=0$.
We want to know if there is a path with $g(x,y)=0$ throughout starting at $(1,0)$ and ending at $(0,1)$. This is equivalent to saying the hikers may meet (as they will meet in the middle when they swap positions like in this example). The only way this could fail to happen is if there is some path of illegal positions $\gamma$ running from $(1,x)$ or $(x,1)$ to a position of $(0,x)$ or $(x,0)$, which would divide the square suitably. Notice, moreover, that $g(1,x)\leq 0$ and $g(0,x)\leq 0$ whereas $g(x,1)\geq 0$ and $g(x,0)\geq 0$. As the sign of $\gamma$ must not change due to the intermediate value theorem, it either runs bottom to top or left to right. However, this is impossible as it must then intersect the line $x=y$, along which $g(x,y)=0$, which must not be true of any point on $\gamma$. Therefore, no path of illegal positions divides the space into two parts, and there is thus, to the contrary, a path from $(0,1)$ to $(1,0)$, as desired.
(*I will admit I have no proof in mind to show that "two points in a closed set in $S$ are disconnected if only if a path in the complement divides them." Maybe someone who wants to do some analysis can fill this in. In the piecewise case, we can, with some reductions, work on a discrete grid rather than the unit square and the proof is obvious there)