  Let $G$ be a compact connected Lie group and $n\geqslant 1$ an integer.
Consider the space of ordered commuting $n$-tuples in $G$,
$Hom(\mathbb{Z}^n,G)$, and its quotient under the adjoint action,
$Rep(\mathbb{Z}^n,G):=Hom(\mathbb{Z}^n,G)/G$. In this article we study and in
many cases compute the homotopy groups $\pi_2(Hom(\mathbb{Z}^n,G))$. For $G$
simply--connected and simple we show that $\pi_2(Hom(\mathbb{Z}^2,G))\cong
\mathbb{Z}$ and $\pi_2(Rep(\mathbb{Z}^2,G))\cong \mathbb{Z}$, and that on these
groups the quotient map $Hom(\mathbb{Z}^2,G)\to Rep(\mathbb{Z}^2,G)$ induces
multiplication by the Dynkin index of $G$. More generally we show that if $G$
is simple and $Hom(\mathbb{Z}^2,G)_{1}\subseteq Hom(\mathbb{Z}^2,G)$ is the
path--component of the trivial homomorphism, then
$H_2(Hom(\mathbb{Z}^2,G)_{1};\mathbb{Z})$ is an extension of the Schur
multiplier of $\pi_1(G)^2$ by $\mathbb{Z}$. We apply our computations to prove
that if $B_{com}G_{1}$ is the classifying space for commutativity at the
identity component, then $\pi_4(B_{com}G_{1})\cong \mathbb{Z}\oplus
\mathbb{Z}$, and we construct examples of non-trivial transitionally
commutative structures on the trivial principal $G$-bundle over the sphere
$\mathbb{S}^{4}$.
