Does this algorithm for permuting rows and columns of a matrix converge?
For an $n \times m$ matrix $M$, define the potential function
$$
\Phi(M) = \sum_{i=1}^n \sum_{j=1}^m 2^{n-1-i} 2^{m-1-j} M(i,j).
$$
If we write it as
$$
\Phi(M) = \sum_{i=1}^n 2^{n-1-i} \sum_{j=1}^m 2^{m-1-j} M(i,j)
$$
then it immediately follows that reordering rows either fixes $M$, or strictly increases $\Phi$. Similarly, reordering columns either fixes $M$ or strictly increases $\Phi$. Since there are only finitely many $n \times m$ matrices, it follows that your algorithm eventually converges.
It is definitely not the case that the process terminates after three steps. For example, here is a matrix which requires five steps:
$$
\begin{pmatrix}
0&amp;0&amp;1&amp;0 \\
0&amp;1&amp;0&amp;0 \\
1&amp;0&amp;0&amp;1 \\
0&amp;0&amp;1&amp;1
\end{pmatrix}
$$
This is a matrix in which the $(i,j)$'th entry depends only on $i+j$. Specifically, $M(i,j) = 1$ iff $i+j \in \{4,7,8\}$.
More generally, the $n \times n$ matrix $M$ in which $M(i,j)=1$ iff $i+j \in \{4,2n-1,2n\}$ requires $2n-3$ rounds, which is optimal for small values of $n$ (over all $n \times n$ matrices). Moreover, this is the unique choice over matrices of this form.
(To complete the picture, for $n = 3$ the unique optimal choice is $i + j \in \{4,6\}$ rather than $i+j \in \{4,5,6\}$, and for $n = 2$ the only choices are $i+j \in \{4\}$ and $i+j \in \{3,4\}$, which both correspond to two rounds.)