I am trying to find all ring isomorphism $\phi $of $\mathbb{C}$ onto itself such that for any $a\in \mathbb{R} $ we have $\phi (a)=a$
The isomorphism preserves the algebraic structures $f(x+y)=f(x)+f(y)$ and $f(xy)=f(x)f(y)$.
This means $f(i^2)=f(-1)=f(i)f(i)$. So we have $f(i)=\pm i $ then we have identity isomorphism and conjugation isomorphism.
Is this true? I think we don't use the fact for any $a\in \mathbb{R} $ we have $\phi (a)=a$ so this is additional condition?
Suppose you didn't have the condition $\varphi(a) = a$ for all $a \in \mathbb{R}$. Then, even though you can show that $\varphi(i)$ must either be $i$ or $-i$, you still don't know where $\varphi$ sends a generic complex number of the form $a+bi$ (because you don't know where it sends the real numbers $a$ and $b$).
So, you need this condition to show that $\varphi$ is either the identity or conjugation.
More explicitly, suppose $\varphi \colon \mathbb{C} \to \mathbb{C}$ is a ring isomorphism that fixes all $a \in \mathbb{R}$. As you have shown, we know that $\varphi(i)$ is either $i$ or $-i.$
If $\varphi(i) = i$, then for any $a+bi \in \mathbb{C}$ we have $$\varphi(a+bi) = \varphi(a) + \varphi(b)\varphi(i) = a+bi$$ (where we know that $\varphi(a) = a$, $\varphi(b) =b$ because $a, b \in \mathbb{R}$). So, in this case $\varphi$ must be the identity.
If $\varphi(i) = -i$, then for any $a+bi \in \mathbb{C}$ we have $$\varphi(a+bi) = \varphi(a) + \varphi(b)\varphi(i) = a+b(-i) = a-bi$$ (once again because $a, b \in \mathbb{R}$). So, in this case $\varphi$ must be conjugation.
Having considered both cases, we see that only the identity and conjugation are possible.