This theorem relies on a very important fact about homomorphisms.
If $\alpha\colon R\to S$ is a ring homomorphism, $I$ is an ideal of $R$ such that $I\subseteq \ker\alpha$ and $\eta\colon R\to R/I$ is the canonical projection, there exists a unique ring homomorphism $\beta\colon R/I\to S$ such that $\alpha=\beta\circ\eta$.
(Uniqueness) Suppose $\beta$ exists. Then, for $r+I\in R/I$, we have
so the action of $\beta$ is determined by $\alpha$ and this settles uniqueness.
(Existence) We want to show that, if $r+I=r'+I$, then $\alpha(r)=\alpha(r')$, so that setting $\beta(r+I)=\alpha(r)$ does not depend on the particular representative of the coset. This is true because $r+I=r'+I$ is equivalent to $r-r'\in I$, which implies $r-r'\in\ker\alpha$ and therefore $\alpha(r-r')=0$: thus $\alpha(r)=\alpha(r')$ as desired.
Therefore the position $\beta(r+I)=\alpha(r)$ defines a map $R/I\to S$; checking it's a ring homomorphism is easy.
Now that we have the general theorem, we can apply it to our present situation. Let $S=R/I_2$ and $\alpha=\eta_2\circ\varphi$.
If we prove that $I_1\subseteq\ker\alpha$, we can apply the theorem and get a unique ring homomorphism $\psi\colon R_1/I_1\to R_2/I_2$ such that
(I use $\psi$ instead of $\beta$ as in the theorem to comply with your notation; $\eta_1\colon R_1\to R_1/I_1$ and $\eta_2\colon R_2\to R/I_2$ are the canonical projection).
All we need is to show that $I_1\subseteq \ker\alpha=\ker(\eta_2\circ\varphi)$, that is, for $x\in I_1$, $\eta_2\circ\varphi(x)=0+I_2$. But, by assumption $\varphi(x)\in I_2$, so $\varphi(x)\in\ker\eta_2$ and therefore