Here's an infinitely generated (abelian) example.
Let $G$ be the quotient of the group of sequences $(a_0,a_1,\dots)$ of integers by the subgroup of finite sequences of even integers. So an element of $G$ is an equivalence class $[(a_0,a_1,\dots)]$ of sequences, where we identify sequences that differ in only finitely many places so long as they agree everywhere mod 2.
Let $H_n$ be the subgroup of equivalence classes of sequences whose first $n$ terms are even. Then $H_n$ is a retract of $G$ via the map
$$[(a_0,\dots,a_{n-1},a_n,a_{n+1},\dots)]\mapsto[(0,\dots,0,a_n,a_{n+1},\dots)].$$
However, $\bigcap H_n$ is the group of equivalence classes of even integers, which is not a retract of $G$ since if $r$ were a retraction then
$$[(2,2,2,\dots)]=r\left([(2,2,2,\dots)]\right)=2r\left([(1,1,1,\dots)]\right),$$
but there is no element $h\in\bigcap H_n$ with
$$[(2,2,2,\dots)]=2h.$$