This has nothing to do with free groups.
So the key isn't just that the $N_1\cong N_2,$ but that the isomorphism $\phi:F_X\to F_Y$ restricts to an isomorphism $\phi_{|N_1}:N_1\to N_2.$
Definition: If $G$ is a group, define $N(G)=\langle g^2\mid g\in G\rangle.$
Claim 1: $N(G)$ is a normal subgroup.
Proof: The follows since $gg_1^2g^{-1}=\left(gg_1g^{-1}\right)$.
If $h\in N(G)$ then $h=g_1^2g_2^2\cdots g_k^2$ for some sequence $g_1,\dots,g_k\in G.$ If $g\in G,$ then $$ghg^{-1}=\left(gg_1g^{-1}\right)^2\left(gg_2g^{-1}\right)^2\cdots \left(gg_kg^{-1}\right)^2\in N(G).$$
Claim 2: If $\phi:G_1\to G_2$ is an isomorphism, then $\phi(N(G_1))= N(G_2).$
Proof: Let $\phi:G_1\to G_2$ be an isomorphism, so $\phi^{-1}$ is also an isomorphism. If $h\in N(G_1),$ then $h=g_1^2g_2^2\cdots g_k^2$ and $\phi(h)=\phi(g_1)^2\phi(g_2)^2\cdots \phi(g_k)^2\in N(G_2).$ Likewise, if $h\in N(G_2),$ $\phi^{-1}(h)\in N(G_1).$ So $\phi,$ restricted to $N(G_1),$ is an isomorphism between $N(G_1)$ and $N(G_2).$
Claim 3: If $\phi$ is an isomorphism between $G_1$ and $G_2,$ and $N_1$ is a normal subgroup of $G_1,$ then $\phi(N_1)$ is a normal subgroup of $G_2,$ isomorphic to $N_1,$ and $G_1/N_1\cong G_2/\phi(N_1).$
I'll leave this last claim to you.
At heart this is all due to the fact that an isomorphism can be thought of as a renaming of the elements of a group. Since the definition of $N(G)$ doesn't care about the names of the elements, the process of computing $N(G)$ and $G/N(G)$ do not depend on the names.