Consider an undirected graph $G=(V, E)$, where $V$ is the set of all squares and $uv\in E\iff$ there is a step moving from $u$ to $v$.
We can see that $G$ is a path with length $99$.
Let the upper-left corner be $(0, 0)$ and the bottom-right corner be $(9, 9)$, and color $(i, j)$ with the $(i+j\pmod2)$-th color.
Since any step connects $2$ squares with different colors, the $2$ vertices in $V$ with degree $1$ have different colors.
Suppose the opposition that there exists a main diagonal s.t. if the rook stepped away from the diagonal, it won't return back to the diagonal in the next step.
WLOG suppose that main diagonal is the main diagonal $y=x$.
Since all squares on $y=x$ have the same color, there is at most $1$ square on $y=x$ with degree $1$.
"If the rook stepped away from the diagonal, it won't return back to the diagonal in the next step." means that any $2$ squares on $y=x$ don't share a neighbor in $G$.
The maximum number of neighbors of squares on $y=x$ is the sum of the numbers of squares on $y=x+1$ and $y=x-1$, which is $18$.
The total number of neighbors of squares on $y=x$ is at least $19$ since at most $1$ square on $y=x$ has degree $1$, contradiction.
$\therefore$ in the rook’s path there were two consecutive steps at which the rook first stepped away from the diagonal and then returned back to the diagonal.