The proof to this fact has to do with a mathematical concept known as Brouwer's degree of a mapping.
If one were to consider a mapping $f:\mathcal{M}\rightarrow G$ from $\mathcal{M}$ being the space-time manifold to some gauge group $G$, then the Brouwer degree of this map is
$$\deg f = \frac{\int_{\mathcal{M}} f^* \omega}{\int_G \omega}, \tag{1}$$
for any $m$-form $\omega$, where $\dim G =m$. Here $f^* \omega$ is defined as the pull-back under the mapping $f$. The quantity (1) is in general an integer.
But let's have a look at the specific case of $\mathcal{M}= S^3$ and $G= SU(2)$.
Let's consider the function $U$, parametrizing a general element of $SU(2)$,
$$ U= e^{-i \phi\sigma_3} e^{-i \theta \sigma_2} e^{-i \psi \sigma_3},$$
where $0<\phi< 2\pi$, $0<\theta< \pi$, $0<\psi< 4\pi$ are the Euler angles. This mapping covers every point of $SU(2)$ exactly once. Then we can define a $3$-form
$$ \omega = U^{-1}dU \wedge U^{-1}dU \wedge U^{-1}dU.$$
Performing the integral over $SU(2)$ yields
$$ \int_{SU(2)} \omega = 24\pi^2.$$
The next step is to recognize that
$$f^* \omega= f^{-1}df \wedge f^{-1}df \wedge f^{-1}df.$$
This gives us the result that the Brouwer degree of a mapping from $S^3$ into $SU(2)$ is the winding number that you speak of. Now if you believe that the Brouwer degree is an integer, this completes the proof. But let's say that you don't believe that.
Now to see that $\deg f$ is an integer, we need to show that it doesn't change under small perturbations. Let's vary $f\rightarrow f+\delta f$ and showing that the integral of the first order variation of $\deg f$, which we define to be $\delta w(g)$, vanishes. Using the fact that $(f+\delta f)^{-1} = f^{-1} - f^{-1} \delta f f^{-1}$ to first order and the cyclicity of the trace, we can show that
\begin{align}
\int d^3x \, \delta w(g) = \frac{1}{24 \pi^2} \epsilon^{\mu \nu \rho} \int d^3 x \, 3 \partial_{\mu}\mathrm{Tr} \left[(f^{-1} \delta f) f^{-1} \partial_{\nu} f f^{-1} \partial_{\rho} f \right].
\end{align}
Using Stokes' theorem and requiring that the variation $\delta f$ vanishes at the boundary (or equivalently, considering a manifold without a boundary, which is the case for $S^3$), we see that
\begin{align}
\int d^3 x \, \delta w(g) =0.
\end{align}
Thus we see that the winding number is unaffected by small variations of the mapping.
Now, in order to complete the proof, we will use the fact that maps between $S^3$ and $SU(2)=S^3$ are classified by the third homotopy group of the sphere $\pi_3(S^3)= \mathbb{Z}$. This means that the function $f$ can only wrap around the $SU(2)$ an integer number of times and so the integral $\int_{\mathcal{M}} f^* \omega$ can yield only an integer number times $\int_{SU(2)} \omega.$
The above example only shows that
$$ W[U] = \frac{1}{24 \pi^2} \int d^3x \ \epsilon^{\mu \nu \beta} \ \text{Tr}(U \partial_{\mu} U^{-1} \ U \partial_{\nu} U^{-1} \ U \partial_{\beta} U^{-1})$$
is an integer for $SU(2)$ and indeed for other gauge groups, one gets different normalizations and in this way one can get different quantization conditions on the Chern-Simons level. See this question, for example.