Yes. Let $T$ be the theory of two disjoint groups, in the language $(\cdot_1, \cdot_2, U_1, U_2)$. Note that if $(G_1, G_2) \models T$ then the group operation on $G_1 \times G_2$ is definable without parameters. Thus we can recover the theory of $G_1 \times G_2$ from the theory of $(G_1, G_2)$, which is clearly determined by $(\mbox{Th}(G_1), \mbox{Th}(G_2))$. Thus if $G_1, G_2, G_1', G_2'$ are any groups with each $G_i \equiv G_i'$, then $G_1 \times G_2 \equiv G_1' \times G_2'$.

EDIT: this just shows elementary equivalence. In order to get elementary extensions: let $G_1, G_2$ be given groups, and consider the language $(\cdot_1, \cdot_2, U_1, U_2,c_g: g\in G_1, d_h: h \in G_2)$ where we add constant symbols for elements of $G_1$ and $G_2$. Let $T_*$ assert that $T$ holds, and the elementary diagram of $G_1$ holds in $U_1$, and the elementary diagram of $G_2$ holds in $U_2$. Note that $T_*$ is actually complete. Now let $(G_1', G_2', g, h)_{g \in G_1, h \in G_2} \models T_*$. Then the group operation on $G_1' \times G_2'$ is definable without parameters, and further every element of $G_1 \times G_2$ is definable without parameters. Thus $(G_1 \times G_2, (g, h))_{g \in G_1, h \in G_2} \equiv (G_1' \times G_2', (g, h))_{g \in G_1, h \in G_2}$, since each sentence must be decided by $T_*$; this is the same as saying $G_1 \times G_2 \preceq G_1' \times G_2'$.