This is an "alldifferent" constraint. In addition to the two approaches already described, I'll describe two more.
Binary encoding
Yet another way is to use a binary encoding of a location that differs, rather than a one-hot encoding as in RobPratt's answer. In particular, we'll have binary decision variables $x_{jk\ell}$, where $x_{jk\lg n} \cdots x_{jk1} x_{jk0}$ is intended to be interpreted as the binary representation of a row $i$ such that $a_{i,j} \ne a_{i,k}$. To ensure this representation is valid, we add the constraint
$$(x_{jk0} \ne i_0) \lor (x_{jk1} \ne i_1) \lor \dots \lor (x_{jk\lg n} \ne i_{\lg n})$$
for every $i,j,k$ such that $a_{i,j} = a_{i,k}$. Here I write $i_\ell$ for the $\ell$th bit of the binary representation of $i$. The above constraint can be expressed as a linear inequality as
$$1 \le \sum_{i_\ell=0} x_{jk\ell} + \sum_{i_\ell=1} (1-x_{jk\ell}),$$
where the first sum ranges over $\ell$ such that $i_\ell=0$ and the second sum ranges over $\ell$ such that $i_\ell=1$, and we have one linear inequality per $i,j,k$ such that $a_{i,j}=a_{i,k}$ and $j<k$.
This approach uses about $0.5 m^2 \lg n$ binary variables and $0.5 m^2 n$ linear inequalities. Compare to RobPratt's answer, which uses $m^2 n$ binary variables and $m^2 n$ linear inequalities. So, this approach is more concise than RobPratt's answer: it uses significantly fewer variables and $2\times$ fewer inequalities. However, it is possible that it might play less well with solvers (e.g., because randomized rounding is less likely to be effective).
Sorting networks
Another approach is to build a sorting network to sort the $m$ columns, then after they are put into sorted order, add constraints to ensure that each adjacent pair of columns are different.
You can build a sorting network to sort the $m$ columns using $O(\log^2 m)$ layers, where each layer has $O(m)$ comparators. You can express each comparator in ILP using $O(n)$ binary variables and $O(n)$ linear inequalities. This leads to a sorting network that uses $O(mn\log^2 m)$ variables and inequalities. The final check that each adjacent pair of columns are different can be done with $O(mn)$ variables and inequalities.
So, in total, this gives a solution that encodes your problem as an ILP instance with $O(mn \log^2 m)$ variables and inequalities. For small $m,n$, this is probably worse than the other approaches, but for large values of $m$, it is possible that this might work better.