*(Crossposting my counterexample [from MSE][1] here)*

Let $G=Q_8\times D_8$, where $Q_8$ is the quaternion group and $D_8$ is the dihedral group of order $8$.

Let $f$ be the isomorphism $$f:G\times G =\left(Q_8\times D_8\right)\times \left(Q_8\times D_8\right)\longrightarrow \left(Q_8\times Q_8\right)\times \left(D_8\times D_8\right).$$
Now, let $\mu$ and $\lambda$ be the epimorphisms $$\begin{eqnarray*}\mu:Q_8\times Q_8&\longrightarrow&Q_8 {\small \text{ Y }} Q_8\\ \lambda:D_8 \times D_8&\longrightarrow&D_8 {\small \text{ Y }}D_8\end{eqnarray*}$$
where $A {\small \text{ Y }} B$ denotes the central product of $A$ and $B$.  Then $$\mu\times \lambda:\left(Q_8\times Q_8\right)\times \left(D_8\times D_8\right)\longrightarrow \left(Q_8 {\small \text{ Y }}Q_8\right)\times \left(D_8 {\small \text{ Y }}D_8 \right)$$
is an epimorphism.  The key is that $D_8{\small \text{ Y }} D_8\cong Q_8{\small \text{ Y }} Q_8$, so if we take an isomorphism $$\phi:D_8{\small \text{ Y }} D_8\longrightarrow Q_8{\small \text{ Y }} Q_8,$$ we can take $H=Q_8{\small \text{ Y }} Q_8$ and form an isomorphism
$$1_H\times \phi:\left(Q_8 {\small \text{ Y }}Q_8\right)\times \left(D_8 {\small \text{ Y }}D_8 \right)\longrightarrow \left(Q_8 {\small \text{ Y }}Q_8\right)\times \left(Q_8 {\small \text{ Y }}Q_8 \right)=H\times H.$$
So, all in all, we have 
$$\newcommand{\ra}[1]{\kern-1.5ex\xrightarrow{\ \ #1\ \ }\phantom{}\kern-1.5ex}
\newcommand{\ras}[1]{\kern-1.5ex\xrightarrow{\ \ \smash{#1}\ \ }\phantom{}\kern-1.5ex}
\newcommand{\da}[1]{\bigg\downarrow\raise.5ex\rlap{\scriptstyle#1}}
\begin{array}{c}
\left(Q_8\times D_8\right) \times \left( Q_8 \times D_8 \right)& \ra{f} &\left(Q_8\times Q_8\right) \times \left( D_8 \times D_8 \right)&\\
& & \da{\mu\times \lambda} & &  & & \\
& & \left(Q_8 {\small \text{ Y }}Q_8\right)\times \left(D_8 {\small \text{ Y }}D_8\right) & \ras{1_H\times \phi} & \left(Q_8 {\small \text{ Y }}Q_8\right)\times \left(Q_8 {\small \text{ Y }}Q_8\right)
\end{array}
$$
and thus an epimorphism $$f(\mu\times\lambda)(1_H\times \phi):G\times G\longrightarrow H\times H.$$
However, $Q_8{\small\text{ Y }}Q_8$ is not a homomorphic image of $Q_8\times D_8$. So this is a counterexample.

*(Credit and thanks to Peter Sin for the crucial step in this answer.)*

  [1]: http://math.stackexchange.com/a/477628/12952