Extending somewhat Aaron's answer:
Theorem. Let $G$ be a group, and let $N$ be a normal subgroup of $G$. If $f\colon G\to K$ is a homomorphism, then $f$ factors through the canonical projection $\pi\colon G\to G/N$ as $f = \widehat{f}\circ\pi$ (with $\widehat{f}(gN) = f(n)$ a homomorphism) if and only if $N\subseteq \mathrm{ker}f$. The map $\widehat{f}$ is one-to-one if and only if $N=\mathrm{ker}(f)$.
Proof. Suppose $f=\widehat{f}\circ\pi$ and $f$ is a homomorphism; then $N=\mathrm{ker}(\pi)\subseteq\mathrm{ker}(f)$ because the kernel of a composition of homomorphisms always contains the kernel of the first map applied. Conversely, suppose that $N\subseteq \mathrm{ker}(f)$. Then $\widehat{f}$ is well-defined: if gN=g'N, then g^{-1}g'\in N\subseteq \mathrm{ker}(f), so 1=f(g^{-1}g')= f(g)^{-1}f(g'), hence f(g)=f(g'), and $\widehat{f}$ is well-defined. It is also a group homomorphism, since \widehat{f}(gg'N) = f(gg') = f(g)f(g') = \widehat{f}(gN)\widehat{f}(g'N). Finally, for every $g\in G$, $\widehat{f}\circ\pi(g) = \widehat{f}(gN) = f(gN)$, so $\widehat{f}\circ\pi = f$.
For the final clause: $\widehat{f}$ is one-to-one if and only if $\widehat{f}(gN) = 1$ holds if and only if $g\in N$; but $\widehat{f}(gN)=1$ if and only if $f(g)=1$ if and only if $g\in\mathrm{ker}(f)$, so $\widehat{f}$ is one-to-one if and only if $g\in N\Leftrightarrow g\in\mathrm{ker}(f)$, if and only if $N=\mathrm{ker}(f)$, as claimed. $\Box$
Your desired result now holds by letting $f = \pi_2\circ f_2$, where $\pi_2\colon G\to G/H_2$ is the canonical projection. The map factors through $G/H_1$ in the desired way if and only if $H_1\subseteq \mathrm{ker}(f)$, if and only if $H_1\subseteq \pi_2\circ f_2$, if and only if $H_1\subseteq f_2^{-1}(\mathrm{ker}(\pi_2))$, f and only if $H_1\subseteq f_2^{-1}(H_2)$, with equality if and only if the induced map is one-to-one.