Reduce to the case when $G$ is connected.

Because $H$ is compact, $\pi_0(H)$ is finite, so by the homotopy long exact sequence $\pi_1(G)\to \pi_1(G/H) = \mathbb Z^n$ maps onto a finite index subgroup, hence $H^1(G/H, \mathbb Z) \to H^1(G, \mathbb Z)$ is surjective. Fix an invariant metric on $G$ and, applying Hodge theory, represent a basis of $H^1(G/H, \mathbb R)$ by harmonic $1$-forms.

The harmonic $1$-forms are unique, so since the cohomology classes are $G$-invariant, the $1$-forms are $G$-invariant. Hence they give a homomorphism from the Lie algebra of $G$ to the abelian Lie algebra of rank $n$. This gives a homomorphism from the universal cover of $G$ to $\mathbb R^n$ and hence a, after modding out by the lattice corresponding to the homology of $G/H$, a homomorphism from $G$ to a torus.

I really wish we were done at this point, but I don't see a way to make the next part easy:

The image of $H$ in this torus is a closed subgroup, hence a finite union of tori. It cannot contain a nontrivial torus or else there would be a nontrivial map from $\pi_1$ of $H$ to $\pi_1$ of that nontrivial torus to $\pi_1$ of $G/H$. So it is a finite union of points. But the map from $\pi_0$ of $H$ to the torus factors through $H_1(G/H)$, hence factors through the zero map. So the image of $H$ is trivial. If $H'$ is the kernel of the map to this torus, then $G/H \to G/H'$ is a homotopy equivalence. Its also a fibration, so the fiber is contractible. The fiber is a compact manifold, so it's a point. Hence $H=H'$ and $G/H=G/H'$ is a torus.