For a more elementary treatment ...
Fact. If the rows of $A$ are linearly dependent, then the rows of $A B$ are linearly dependent.
Proof of fact. Consider the 3x3 case, where the linearly-dependent rows of $A$ are $\mathbf{a}_1$, $\mathbf{a}_2$, $\mathbf{a}_3 = h \mathbf{a}_1 + k \mathbf{a}_2$ (for some scalars $h$ and $k$):
$$A = \begin{bmatrix}\mathbf{a}_1 \\ \mathbf{a}_2 \\ h\mathbf{a}_1 + k\mathbf{a}_2\end{bmatrix} = \begin{bmatrix}p & q & r \\ s & t & u \\ hp + ks & hq + kt & hr + ku \end{bmatrix}$$
Writing $\mathbf{b}_1$, $\mathbf{b}_2$, and $\mathbf{b}_3$ for the rows of $B$, we have
$$A B = \begin{bmatrix}p & q & r \\ s & t & u \\ hp + ks & hq + kt & hr + ku \end{bmatrix} \begin{bmatrix}\mathbf{b}_1 \\ \mathbf{b}_2 \\ \mathbf{b}_3\end{bmatrix} = \begin{bmatrix}p
\mathbf{b}_1+ q\mathbf{b}_2 + r\mathbf{b}_3 \\ s\mathbf{b}_1 + t\mathbf{b}_2 + u\mathbf{b}_3 \\ (hp + ks)\mathbf{b}_1 + (hq + kt)\mathbf{b}_2 + (hr + ku)\mathbf{b}_3 \end{bmatrix}$$
$$= \begin{bmatrix}p
\mathbf{b}_1+ q\mathbf{b}_2 + r\mathbf{b}_3 \\ s\mathbf{b}_1 + t\mathbf{b}_2 + u\mathbf{b}_3 \\ h(p\mathbf{b_1}+q\mathbf{b}_2+r\mathbf{b}_3) + k(s\mathbf{b}_1 + t\mathbf{b}_2 + u\mathbf{b}_3) \end{bmatrix}$$
Generally, the linear dependence of the rows of $A$ carries over to the rows of the product, proving our Fact. (This reasoning actually shows the more-precise Fact that $rank(AB)\le rank(A)$.)
We can restate the Fact this way:
Re-Fact. If the rows of $AB$ are linearly independent, then the rows of $A$ are linearly independent.
To your question: If $A B = I$, then (by the Re-Fact) the rows of $A$ must be linearly independent. This implies that $A$ can be row-reduced to a diagonal matrix with no zero entries on that diagonal: the row-reduced form of $A$ must be the Identity matrix.
Note that row-reduction is actually an application of matrix multiplication. (You can see this in the equations above, where (left-)multiplying $B$ by $A$ combined the rows of $B$ according to the entries in the rows of $A$.) This means that, if $R$ is the result of some row combinations of $A$, then there exists a matrix $C$ that "performed" the combinations:
$$C A = R$$
If (as in the case of your problem) we have determined that $A$ can be row-reduced all the way down to the Identity matrix, then the corresponding $C$ matrix must be a (the) left-inverse of $A$:
$$C A = I$$
It's then straightforward to show that left and right inverses of $A$ must match. This has been shown in other answers, but for completeness ...
$$A B = I \;\; \to \;\; C (A B) = C \;\; \to \;\; (C A) B = C \;\; \to \;\; I B = C \;\; \to \;\; B = C$$
Once you start thinking (ahem) "outside the box (of numbers)" to interpret matrices as linear transformations of vectors and such, you can interpret this result in terms of mapping kernels and injectivity-vs-surjectivity and all the kinds of sophisticated things other answers are suggesting. Nevertheless, it's worth noting that this problem is solvable within the realm of matrix multiplication, plain and simple.