Here is an argument that is essentially the same as Oscar's, but organized a little differently.
First, we have a fibration $S^3\to X\to\Sigma$, giving an exact sequence
$$ \pi_2(\Sigma) \to \pi_1(S^3)=0 \to \pi_1(X)\xrightarrow{\pi_*}\pi_1(\Sigma) \to \pi_0(S^3) = 0, $$
which proves that $\pi_*$ is an isomorphism.
Next put $G=\pi_1(\Sigma)$ and let $U$ be the universal cover of $\Sigma$, so that $\Sigma=U/G$. For any connected based space $Z$, there is a natural map
$$ \alpha_Z\colon [Z,\Sigma] \to \text{Hom}(\pi_1(Z),G)/\text{conjugacy}. $$
(We have to take the conjugacy quotient because we are considering unbased homotopy classes of unbased maps.) It is standard that $U$ is homeomorphic to $\mathbb{R}^2$ and so is contractible. Using this, covering theory proves that $\alpha_Z$ is always bijective. By taking $Z=\Sigma$ or $Z=X$, we deduce that the map
$$\pi^*\colon[\Sigma,\Sigma]\to[X,\Sigma]$$
is bijective. It follows that every map $X\to\Sigma$ is homotopic to one that factors through $\pi$, as required.