I've come across a comment in a paper that hints at a relation between the set of (flat) connections for a principal bundle and the homotopy group of the base of the bundle. Can anyone tell me what the exact correspondence is here? Is the homotopy space some kind of moduli space for the flat connections?

The comments have addressed relating fundamental group and a flat connection. Something can be said about the moduli space of flat connections. Goldman, in http://www.springerlink.com/content/g468047131514211/, considers the moduli space of flat connections over a surface genus $>1$. He defines a symplectic form and relates is to the free homotopy classes of closed curves. Karshon, in http://www.jstor.org/stable/2159424, and Abbaspour and Zeinalian, in http://www.msp.warwick.ac.uk/agt/2007/07/b009.html, discuss some generalizations. Here is a brief description of Goldman's work. Let $S$ be a surface of genus $g>1$. The moduli space of flat connections over $S$ has singularities, but at manifold points the tangent space can be identified with the first cohomology of $S$ with coefficients in a flat bundle, $H^1(S; \text{flat bundle})$ (defined in the paper). A two form is defined by taking the cup product of two elements in $H^1(S; \text{flat bundle})$ and evaluating the product on $[S]$. This form is closed and nondegenerate a symplectic form. Then the smooth functions on the moduli space of flat connections, denoted $C^\infty(\text{moduli space})$, with the Poisson bracket is a Lie algebra. Let $\hat \pi$ be the conjugacy classes of elements in $\pi_1(S)$ i.e. the free homotopy classes of closed curves in $S$ and let $\mathbb{Z} \hat \pi$ be the free abelian group generated by the classes. The Goldman bracket is a Lie bracket on $\mathbb{Z} \hat \pi$ defined by choosing representatives, taking the free homotopy class represented by the composition of the curves at intersection points, and taking the sum of all such classes. This is welldefined and satisfies the Jacobi identity. A closed curve in $S$ defines a function on the moduli space of flat connections defined by taking the trace of the holonomy of the curve with respect to a connection. Since the connections are flat, the function is independent of choice of representative in $\mathbb{Z} \hat \pi$. Goldman shows that this map $$\mathbb{Z} \hat \pi \rightarrow C^\infty(\text{moduli space}) $$ is a map of Lie algebras. 

