The statement is true for  a $K(\pi,1)$, but not generally true for other $X$. 

Here's one proof.  Let me use the notation $B\pi$ for the $K(\pi,1)$. There's a fibration
$$
\Omega B\pi \to L B\pi \to B\pi 
$$
whre $LX$ is the space of unbased loops in a space $X$ and the second map in the sequence is evaluation at the basepoint of the circle. The fiber 
appearing is the based loop space of $B\pi$. It has the homotopy type of the discrete space given by the underlying set of $\pi$.  

If $L_0B\pi \subset LB\pi$ is the subspace of contractible loops, then the evaluation 
$$
L_0B\pi \to B\pi
$$
is also a fibration with fiber $\Omega_0 B\pi$, the space of contractible based loops.  It's easy to see $\Omega_0 B\pi \subset \Omega B\pi \simeq \pi$ is the connected component of the constant based loop. It follows from this that $\Omega_0 B\pi$ is contractible. 

Hence, the map $L_0 B\pi \to B\pi$ is a weak homotopy equivalence––and therefore a homotopy equivalence since the spaces in question have the homotopy type of a CW complex.