For $3$ x $3$:
It doesn't matter which row corresponds to which column or where the row/column is, because trading places doesn't prevent a square from satisfying the conditions.
The primes $5$ and $7$ are important for a $3$x$3$ square. They can't be on the same row or column, because then they can't be on the other row/column where the other is to satisfy the conditions. So, let's have this:
$5$ $x$ $yn$
$y$ $7$ $xk$
$xn$ $yk$ $z$
$1$, $2$
$3$, $6$
$4$, $8$
So $x$ can be $1$, $y$ can be $2$ and $n=3$. This gives us:
$5$ $1$ $6$
$2$ $7$ $4$
$3$ $8$ $9$
Generalization (partial, rule of thumb):
Start with finding the primes that can't divide any other number (the ones larger than $n^2/2$) to put them all on a diagonal line. The diagonal isn't technically necessary, but it helps keep things tidy. But for some numbers, there are more primes between $n^2/2$ and $n^2$ than $n$, leaving no room for some primes, such as a $9$ x $9$ square.