Think of matrices as linear transformations. If you have a map of vector spaces $f:V\to W$ and a $n$-dimensional subspace $U$ of $V$, then the image $f(U)$ has dimension at most $n$. Given two matrices $A,B$, they represent linear maps $A:K^m\to K^m, B:K^n\to K^m$. Now by applying the the remark above to the images of these maps we see that the dimension of the image $(AB)(K^n)$ can be at most the rank of $A$ and $B$, hence $$\operatorname{rank}(AB)\leq\min(\operatorname{rank}A,\operatorname{rank}B)$$
Now assume that $A$ has determinant $1$, in this case the corresponding map $K^m\to K^m$ is an isomorphism, so we get $\dim \operatorname{im}(AB)=\dim\operatorname{im} B$, and therefore $\operatorname{rank}(AB)=\operatorname{rank}B$.