The statement is true for a $K(\pi,1)$, but not true for other $X$. Here's a sketch: let $X = K(\pi,1)$. Let $\Omega_0 X$ be the space of contractible based loops in $X$. It's easy to show that the homotopy groups of this space are trivial in every degree (in degree 0 by definition and in higher degrees since $X$ is a $K(\pi,1)$ space, using the fact that $\pi_j(\Omega_0X) = \pi_{j+1}(X)$ for $j >0$). Let $L_0 X$ be the space of contractible unbased loops. Then the sequence $$ \Omega_0 X \to L_0 X \to X $$ is a fibration, where the second map is evaluation at the basepoint of the circle. Since the fiber has trivial homotopy groups, it follows that the map $L_0X \to X$ is a weak homotopy equivalence. It's therefore a homotopy equivalence since the spaces in question have the homotopy type of a CW complex.