A simple question about fundamental groups. I am starting to study fundamental groups and came across the following result:

This makes total sense to me, but further reading I came across the following justification for a result:
So, after all, my final question is:
If two groups are isomorphic, so is their fundamental group?
 A: You're mixing categories here.
The fundamental group applies to topological spaces, not to groups.
Now, it just so happens that there are things called topological groups, objects that are both topological spaces and groups (such that the group operations are continuous functions). So it is certainly fair to ask about the fundamental groups of $S^1$ and of $SO(2)$ as topological spaces. And it's true that those two topological groups are isomorphic as topological groups, meaning that there is a bijection between them that is simulaneously a group isomorphism and a homeomorphism. So, given that they are homeomorphic, it follows that their fundamental groups are isomorphic.

To follow up on the latest comments, let me carry out the calculations needed, in order to verify that your $f$ gives a homeomorphism from $S^1$ to $SO(2)$, emphasizing the role of coordinates in this process.
Let's use $x,y$-coordinates on $\mathbb R^2$ in order to define
$$S^1 = \{(x,y) \mid x^2 + y^2 = 1\}
$$
Also, let's use $a,b,c,d$-coordinates on $\mathbb R^4$ in order to define
$$SO(2) = \left\{ \begin{pmatrix} a & b \\ c & d \end{pmatrix} \biggm| a^2 + b^2 = 1, c^2 + d^2 = 1, ac + bd = 0, ad - bc = 1\right\}
$$
(In what follows, I'm going to use this formula for $SO(2)$ to identify $SO(2)$ with a subset of $\mathbb R^4$).
Your function, as you have written it, is
$$f(x,y) = \begin{pmatrix} x & -y \\ y & x \end{pmatrix}
$$
We can rewrite this as
$$(*) \qquad a(x,y) = x, \quad b(x,y) = -y, \quad c(x,y) = y, \quad d(x,y) = x
$$
As you have said, this formula restricts to a group isomorphism from $S^1$ to $SO(2)$. Also, the four functions in $(*)$ obviously define a continuous function $\mathbb R^2 \mapsto \mathbb R^4$, and so they restrict to a continuous function $S^1 \to SO(2)$.
Now we need to write down a formula for a function $g : SO(2) \to S^1$ which is an inverse to $f$. Given a matrix $\begin{pmatrix} a & b \\ c & d \end{pmatrix}$ that is known to be in $SO(2)$, one can use the formula
$$g\begin{pmatrix} a & b \\ c & d \end{pmatrix} = (a,-b)
$$
or, alternatively
$$(**) \qquad x(a,b,c,d) = a, \quad y(a,b,c,d) = -b
$$
But these formulas in fact define a function on all of $\mathbb R^4$, with values in $\mathbb R^2$, that is, $g : \mathbb R^4 \to \mathbb R^2$. It's restriction gives a function $g : SO(2) \mapsto S^1$, that is obviously an inverse of your original function $f : S^1 \to SO(2)$.
Note: I'm not asserting that $f : \mathbb R^2 \to \mathbb R^4$ and $g : \mathbb R^4 \to \mathbb R^2$ are inverse functions; I don't even need that to be true. All I need to be true is that the restricted function $f : S^1 \to SO(2)$ and the restricted function $g : SO(2) \to S^1$ are inverse functions.
So all that is left is to observe that the function $g : \mathbb R^4 \mapsto \mathbb R^2$ defined by the formulas $(**)$ is obviously continuous, hence it restricts to a continuous function $SO(2) \mapsto S^1$.
A: Not in the general case because your group structure doesn't need to be related to your topology.
Consider the group $(S^1, *)$ and an arbitrary bijection $f : S^1 \rightarrow S^2$. We will artificially give $S^2$ the structure of a group through $f$. Define $\star : S^2 \times S^2 \rightarrow S^2$ as
$$ x \star y = f(f^{-1}(x) * f^{-1}(y)) $$
$(S^2, \star)$ is by construction a group with $f(0)$ as the neutral element but $\pi_1(S^1) = \mathbb{Z}$ and $\pi_1(S^2) = 0$.
If we want to consider "at the same time" the topological and group structure of a space, i.e., when dealing with topological groups, then an isomorphism of topological groups is also, by definition, a homeomorphism which preserves the fundamental group.
