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.