The statement is false in both finite and infinite ranks. For a counterexample in finite rank, let $G$ be infinite cyclic generated by $x$ (rank $1$), and $H$ be cyclic of order $2$ generated by $y$ (also rank $1$). Let $f\colon G\to H$ be the map sending $x$ to $y$. The minimal generating set $\{x^2,x^3\}$ (which generates $G$, but no proper subset does) is mapped to $\{e,y\}$, which is not minimal. Or you could take $H$ to be cyclic of order $4$, if you want to avoid the trivial element, as then you get $y^2$ and $y^3$; which is not minimal. For infinite rank, take $G=H$ be a direct sum of countably infinitely many copies of the infinite cyclic group; take $\{x_i\}_{i=1}^{\infty}$ as a basis for $G$, and $\{y_j\}_{j=1}^{\infty}$ as a basis for $H$. Take $f\colon G\to H$ be the map that sends $x_{2i-1}$ to $y_i$ and $x_{2i}$ to $y_i^{-1}$.