Witten's QFT and Jones Poly paper Data: $M$ is an oriented 3-dim manifold, $E$ is a $G$-bundle over $M$, with $G$ compact 
simple Lie group. 
Question: How does $\pi_3(G)\cong \mathbb{Z}$ imply that there exists non-trivial 
gauge transformations (i.e., continuous maps $M\rightarrow G$ which are not homotopic to 
the trivial map)?
If anyone would like to read it from the source, check the paragraph leading up to 
equation 1.4.
 A: I think the important information is that $H^3(G,\mathbb{R}) \neq 0$. 
By the way, every $G$-bundle over $M$ is trivializable, under the conditions you have mentioned. That's why a gauge transformation can be regarded as a (smooth) map $g: M \to G$. 
Now you look at the behaviour of the Chern-Simons 3-form $CS(A)$ of a connection $A$ on $E$ under a gauge transformation $g$. The formula is
$$
CS(g^*A) = CS(A) + g^*H + \text{exact terms}.
$$
where $H$ is the canonical 3-form of $G$ that represents a non-trivial element of $H^3(G,\mathbb{R})$. Now you can find a gauge transformation $g$ such that $g^*H$ is not exact. In that sense you have non-trivial gauge transformations. 
EDIT: The comment that every $G$-bundle is trivializable is only true if $G$ is additionally assumed to be simply-connected, sorry. So you either assume that (so does Witten) or you must see gauge transformations as maps $g:P \to G$, rather, and the Chern-Simons form $CS(A)$ as a form on $P$, not on $M$.
A: @kwl1026. Gauge transformations are sections of the Ad bundle $P\times_{Ad} g$ where $P\to M$ is the principal $G$ bundle; $g$ the lie algebra. When $G$ is abelian the adjoint action is trivial so, e.g.  the $U(1)$ gauge group is always $Map(M,U(1))$ whether or not $P$ is trivial. Its homotopy classes are then $[M, U(1)]= H^1(M;Z)$, which is zero (for $M$ a closed 3-manifold) if and only if $M$ is a rational homology sphere.
An elementary answer to your original question for $SU(2)=S^3$ is that  obstruction theory shows that the primary obstruction gives an isomorphism  $[M,S^3]\to H^3(M;Z)$. An induction using the fibration $SU(n)\to SU(n+1)\to S^{2n+1}$ and cellular approximation shows that $[M,SU(n)]=[M,SU(2)]$. Other tricks can get you there for other $G$. It is true that the differnence in Chern-Simons invariants (suitably normalized) coincides with this isomorphism (composed with $H^3(M;Z)\to Z$), as indcated by Konrad. For $SU(2)$ it also agrees with the degree, as mentioned by Peter.
If $P$ is non-trivial you have to work a little harder, since you are asking what is the set of homotopy classes of sections of the fiber bundle  $P\times_{Ad} g$. A useful reference is Donaldson's book on Floer homology.
A: As Konrad Waldorf noted, in this case G-bundles are trivializable (since $\pi_2(G)$ is trivial).  So gauge transformations are just maps
$$\phi:M\rightarrow G$$
and these have a homotopy invariant that can be non-trivial, the degree of the map.  One way to compute this is as
$$\int_M \phi^*\omega_3$$
where $\omega_3$ is a generator of $H^3(G)$.  Or, as usual for a degree, just pick an element of G, and count points (with sign) in the inverse image.
A: First consider the case $M = S^3$. Generalizing, consider the connected sum of a generic M with a sphere $M = M\# S^3$
Edit Here's what I was thinking (Still not sure if it's all correct, but it seems closer to the spirit of Witten's paper than the obstruction arguments.) 
Consider a gauge transform $f': M \rightarrow G$. Also, consider a gauge transformation $g' : S^3 \rightarrow G$ not homotopic to the identity. Continuity allows us to change $f'$ to a map $f$ homotopic to $f'$ such that in a neighborhood $U$ of $p \in M$ the map $f$ maps to the identity of $G$. We can define a map $g$ to have similar properties in a neighborhood $V$ of $q \in S^3$. 
Do the connected sum around $p$ and $q$ and obtain $M\# S^3 = M$ as well as a gauge transform $h$ on $M\# S^3 = M$ obtained by joining $f$ and $g$. Now, assume $h$ is homotopic to the identity. 
The homotopy taking $h$ to the identity can be used to construct a homotopy of $g$ to the identity. (Here we use the fact that $\pi_2(G)$ is trivial to continue the homotopy over the ball removed from $S^3$.) 
But, no such homotopy of $g$ to the identity exists. Thus, $h$ is not homotopic to the identity. Hence, $\pi_3(G) = \mathbf{Z}$ implies there exist continuous maps $M \rightarrow G$ not homotopic to the identity.
