Try $A=\begin{bmatrix}0 & 1\\\\ 1 & 0\\\\ 0 & 0\\\\ 0 & 0\\\\ 0 & 0\end{bmatrix}$ and $B=\begin{bmatrix}0 & 1\\\\ 0 & 0\\\\ 1 & 1\\\\ 0 & 0\\\\ 0 & 0\end{bmatrix}$. Then $rank([A,B])=3$ but $rank(A)=rank(B)=2$.
What is true however, is $rank([A, B])=rank(A)+rank(E_{A}B)$, where $E_{A}$ is the projection defined by $E_{A}=I-AA^{\dagger}$. See p.4 in this paper (the results are much older, going at least back to Marsaglia-Styan in the 70s, but Tian's paper gives a good recap and is easily accesible).