If the compact connected group $K$ is second-countable (hence metrizable, hence Polish), one can prove it with pretty much straight measure theory. (I am not sure if this argument remains valid for non-metrizable groups.)
It's based on the following elementary lemma which is due (in some form) to Steinhaus:
Lemma. Let $G$ be a locally compact Polish group with a left-invariant Haar measure $\mu$, and $A \subset G$ be a Borel set with $\mu(A) > 0$. Then the set $A^{-1} A$ contains an open neighborhood of the identity. In particular, if $A$ is a subgroup of $G$ then $A$ is open.
You can find it as Exercise 17.13 (ii) in Kechris, Classical Descriptive Set Theory. You begin by showing that the function $x \mapsto \mu(xA \triangle A)$ is continuous, which uses the regularity of the measure or else Lusin's theorem. (The proof I know uses dominated convergence and hence only shows that this function is sequentially continuous, which is why I am unsure about the non-metrizable case.)
So let $E = \{(x,y) : xy = yx\} \subset K \times K$. The probability of two elements commuting is $p = (\mu \times \mu)(E)$ where $\mu$ is the left Haar probability measure on $K$. Let $C_x$ denote the centralizer of $x$, which is closed. We have $(x,y) \in E$ iff $y \in C_x$, and thus by Fubini's theorem $$p = \iint 1_E(x,y)\,\mu(dy)\,\mu(dx) = \iint 1_{C_x}(y)\,\mu(dy)\,\mu(dx) = \int \mu(C_x) \,\mu(dx).$$
If we suppose $p >0$, then the set $B = \{x : \mu(C_x) > 0\}$ must have positive measure. But if $\mu(C_x) > 0$, then by our lemma, $C_x$ is an open subgroup of $K$. It was already closed, and $K$ is connected, so $C_x = K$, i.e. $x$ is in the center $Z$ of $K$. Thus $B \subset Z$, so $Z$ is a closed subgroup with positive measure. Applying our lemma again, $Z$ is open and so $Z=K$, i.e. $K$ is abelian.
I think there should also be a "Baire category" analogue of this statement: if $\{ (x,y) : xy = yx\}$ is nonmeager in $K \times K$ then $K$ is abelian. This would use the Pettis lemma in place of the unnamed lemma above, and there is a "Fubini theorem" for Baire category which I've seen but can't recall the name or the reference.