Denote by $P=\{(x,x')\in X\times X\ |\ \pi(x)=\pi(x')\}$. I leave as an exercise that $P$ is an equivalence relationship.
First I will show that every closed equivalence relationship contains $P$.
Proof. Assume that $R\subseteq X\times X$ is a closed equivalence relationship. Consider the quotient space $X/R$. It is well known that it is Hausdorff ($X/{\sim}$ is Hausdorff if and only if $\sim$ is closed in $X \times X$). Now consider the projection
$$p:X\to X/R$$
$$p(x)=[x]$$
Since $X/R$ is Hausdorff then we can apply properties of $\pi$: there is a unique continuous map $\overline{p}:SX\to X/R$ such that $p(x)=\overline{p}(\pi(x))$. It follows that if $\pi(x)=\pi(x')$ then $p(x)=p(x')$. In other words if $(x,x')\in P$ then $(x,x')\in R$. Which is what we wanted to prove. $\Box$
Now we will show that $P$ itself is closed.
Proof. Assume that $(u,v)\in (X\times X)\backslash P$. In particular $\pi(u)\neq \pi(v)$ and since $SX$ is Hausdorff then there are two open, disjoint neighbourhoods $U$ of $\pi(u)$ and $V$ of $\pi(v)$ in $SX$. Since these are disjoint then so are $\pi^{-1}(U)$ and $\pi^{-1}(V)$, and in fact $\pi(x)\neq \pi(y)$ for $x\in \pi^{-1}(U)$ and $y\in \pi^{-1}(V)$. This shows that $\pi^{-1}(U)\times \pi^{-1}(V)$ is an open neighbourhood of $(u,v)$ disjoint from $P$. By the arbitrary choice of $(u,v)$ we conclude that $(X\times X)\backslash P$ is open, and so $P$ is closed. $\Box$
Now since $P$ is closed and contains every other closed equivalence relationship, then $P$ has to be the smallest one among them.
Note that $X$ being compact is irrelevant in all of this.