No. Let's make an example in which both $G_1$ and $G_2$ are one-dimensional. Start by choosing $x$ and $y$ in $\frak{sl}_2(\mathbb R)$ such that the subgroup determined by $[x,y]$ is a circle (the square of this matrix has negative trace) but the subgroups generated by $x$ and by $y$ are isomorphic to $\mathbb R$ (their squares have positive trace). Now in $\frak{sl}_2(\mathbb R)\times \frak{sl}_2(\mathbb R)$ consider the elements $(x,x)$ and $(y,cy)$, where $c$ is some irrational number. These give closed noncompact one-dimensional subgroups $G_1$ and $G_2$, but their commutator gives a dense line in a torus. $SL_2(\mathbb R)\times SL_2(\mathbb R)$ is not simply connected, so embed it in $SL_4(\mathbb R)$ and take that, or rather its double cover, to be $G$.