Because of the two identities you wrote, what we want is essentially:
$$ A^{-1} B^{-1} = B^{-1} A^{-1} $$
We already assumed that A and B are invertible, thus $ \det(A) \neq 0 $ and $ \det(B) \neq 0 $, so $A^{-1} B^{-1}$ should also be invertible, because $\det(A^{-1} B^{-1}) = \det(A^{-1}) \det(B^{-1}) = \det(A)^{-1} \det(B)^{-1} \neq 0 $
Then, if we can invert both the left and the right hand side of the identity above:
$$ (A^{-1} B^{-1})^{-1} = (B^{-1} A^{-1})^{-1} \iff $$
$$ (B^{-1})^{-1} (A^{-1})^{-1} = (A^{-1})^{-1} (B^{-1})^{-1} \iff $$
$$ B A = A B $$
So if the two matrices commute when multiplied (which is generally not true for arbitrary matrices), then it also holds that $(AB)^{-1} = A^{-1} B^{-1}$