Take two circles $C_1, C_2$ intersecting in two points $p_1, p_2$. These are contained in a unique 2-sphere $S$. One way to see this is to assume $p_1=\infty$, $S^n-p_1=\mathbb{R}^n$ (considering $S^n$ as the one-point compactification of $\mathbb{R}^n$). Then the circles $C_1, C_2$ correspond to two lines intersecting in a point $p_2$, which span a unique 2-plane in $\mathbb{R}^n$ corresponding to the sphere $S$.
The images $f(C_i)\subset D_i$, where $D_i$ are circles, and $D_1\cap D_2 = \{f(p_1),f(p_2)\}$. Let $T$ be the unique 2-sphere containing $D_1\cup D_2$. Then I claim $f(S)\subset T$. Normalize it by post-composition with a Moebius transformation so that $f(p_1)=\infty$, then any line intersecting $(C_1\cup C_2)-\infty$ in two points distinct from $p_2$ will map to a line intersecting the lines $D_1\cup D_2-\infty$ in two points, and thus is contained in $T$. So $f(S)\subset T$ since every point of $S$ is contained in a line intersecting $D_1, D_2$ in points distinct from $f(p_2)$.
One can perform a similar inductive argument to show that higher-dimensional spheres are preserved. Take $k$ circles intersecting two points, say $0, \infty$, which span a $k$-plane $K$ in $\mathbb{R}^n$. Then any point on $K$ is contained in a $k-1$-plane $J$ intersecting the $k$ lines in points different from the origin. Then the image is contained in a similar configuration by induction, so the $k$-spheres are taken to $k$-spheres.