Take the unit sphere $S^1$ as a subspace of the simply connected space $\Bbb R^2.$
Note that $S^1$ is not a retract of $\Bbb R^2$. Otherwise, it had to be simply connected, too.
There are some conditions that guarantee that the fundamental group of a space will be abelian. For example, if the fundamental group of an H-space is abelian. In these cases, the first homology group will be isomorphic to the fundamental group (if the space is path connected).
Otherwise, if you're only given the data of $H_1(X)$, you cannot compute $\pi_1(X)$ from that. The reason is simple: if you're given the abelianization of a group $G_{ab}$, the group $G$ could be pretty much anything. It could be the product of $G_{ab}$ with a perfect group, or some other extension of $G$...
To give you an example, a knot in $\mathbb{R}^3$ is almost determined by the fundamental group of its complement (as far as I remember, you also need to specify some orientation -- a knot theorist could correct me if I remember incorrectly). But it's also a theorem that the first homology group of this complement is always $\mathbb{Z}$! Even though knot complements are very well-behaved spaces, you still get a lot with the same first homology group.
In fact the noncommutativity of $\pi_1$ can lead to "strange" situations. For example, if the fundamental group is abelian, then trivial homology ($\tilde{H}_*(X) = 0$) implies trivial homotopy ($\pi_*(X) = 0$). But when the fundamental group is not abelian, then it's not true anymore, and there are in fact tons of so-called acyclic spaces whose homology vanish but who are not contractible. Their fundamental group will be perfect because of the Hurewicz isomorphism, but after that (almost) all bets are off. See for example Acyclic spaces by Dror Farjoun. So not even the whole homology of a space is enough to determine the fundamental group if you don't know that it's abelian.
Another example of possible condition is "$X$ is a co-H-space". The fundamental group of $X$ is then free, so the rank of the abelianization is enough to find $\pi_1$ up to isomorphism. I think you can even find the generators by considering lifts of generators of $H_1$.
Best Answer
Yes, for any group $G$ there exists a (path connected) $K(G,1)$, and there are non-trivial groups with trivial abelianization.