With only a little extra work we can generalize this result to rectangluar matrices, as long as their sizes are such that cyclic permutation is well defined.
Specifically, suppose $A$ is a wide $r$-by-$n$ matrix, and $B$ is a tall $n$-by-$r$ matrix. The nonzero eigenvalues of the $r$-by-$r$ matrix $AB$ are the same as the eigenvalues of a larger $n$-by-$n$ matrix formed by padding with blocks of zeros.
$$\lambda_\text{nonzero}(AB) = \lambda_\text{nonzero}\left(\underbrace{\begin{bmatrix}AB & 0 \\ 0 & 0\end{bmatrix}}_{n\times n\text{ square matrix}}\right)$$
This larger matrix can then be factored as follows:
$$\begin{bmatrix}AB & 0 \\ 0 & 0\end{bmatrix} = \underbrace{ \begin{bmatrix}A \\ 0\end{bmatrix}}_{n\times n\text{ square matrix}}\underbrace{\begin{bmatrix}B & 0\end{bmatrix}}_{n\times n\text{ square matrix}}.$$
But by the result for square matrices (explained by EuYu), the nonzero eigenvalues are preserved if we commute these square factors. Doing so leads to,
$$\begin{bmatrix}B & 0\end{bmatrix}\begin{bmatrix}A \\ 0\end{bmatrix} = BA + 0 = BA.$$
Hence the nonzero eigenvalues of $AB$ equal the nonzero eigenvalues of $BA$.
This can then be extended to cyclic permutations of rectangular matrices that are permitted by their sizes, using the same argument as EuYu explained for square matrices.