This is a substantially more interesting question than the votes indicate; while the initial phrasing is more naive than the real situation permits, a slight generalization is indeed true. The answer below is a slight enhancement of Danny Ruberman's comment.
Theorem. If $Y$ is a closed orientable 3-manifold and $W$ is a compact 4-manifold with $\partial W = Y$ and for which the homomorphism $i_*: \pi_1(Y) \to \pi_1(W)$ admits a retraction $r: \pi_1(W) \to \pi_1(Y)$ with $ri_* = 1_{\pi_1(Y)}$, then in fact $Y \cong \#^m (S^1 \times S^2)$ for some $m \ge 0$, and in particular $\pi_1(Y)$ is free.
The general obstruction is as follows. Whenever you have a pair $(X,\rho)$ of a CW-complex $X$ and a homomorphism $\rho: \pi_1(X) \to G$, you get a map $K\rho: X \to K(G,1)$, well-defined up to homotopy (define it cell-by-cell). The same is true for pairs $(X,Y,f_X, f_Y)$ where $i: Y \hookrightarrow X$ is a subcomplex and $f_X i_* = f_Y$; you obtain a map $Kf_X: X \to K(G,1)$ which restricts to $Kf_Y$ on the subcomplex $Y$.
When $Y$ is a closed oriented $n$-manifold, it has a fundamental class $[Y] \in H_n(Y;A)$ for any coefficient group $A$. Pushing this forward to $K(\pi_1 Y, 1)$, we obtain a group homology class $[Y] \in H_n(\pi_1 Y; A)$ for any coefficients $A$.
If $Y$ is the boundary of a compact oriented $(n+1)$-manifold $W$, the image of $[Y]$ in $H_n(W;A)$ is zero. Now suppose there exists a retraction $r: \pi_1(W) \to \pi_1(Y)$. Then the construction above defines a map of pairs $(W,Y) \to K(\pi_1 Y, 1)$, and naturality together with the fact that $[Y] = 0$ in $H_n(W;A)$ implies that when this is true, $[Y] = 0 \in H_n(\pi_1 Y; A)$.
Our aim is to show that when $n=3$ this is true if and only if $Y = \#^n (S^1 \times S^2)$.
This argument splits into three parts: the aspherical case, the spherical case, and the case of connected sums.
Proposition 1. If $Y$ is an aspherical closed $n$-manifold, then $[Y] \in H_n(\pi_1 Y; A)$ is nonzero for any coefficients $A$.
Proof: The assumption that $Y$ is aspherical means $K(\pi_1 Y, 1) = Y$, and this is simply its fundamental class; that this is nonzero is part of the statement of Poincare duality.
Proposition 2. Suppose $\Gamma$ acts orthogonally and freely on some sphere $S^n = S(\Bbb R^{n+1})$ for $n$ odd. Then $[S^n/\Gamma] \ne 0 \in H_n(\Gamma; A)$ for any coefficients $A$.
Proof: In this situation, one may obtain a CW model for $K(\Gamma, 1)$ so that $S^n/\Gamma$ is its $n$-skeleton and the attaching map $C_{n+1}^{CW} K(\Gamma,1) \to C_n^{CW} K(\Gamma, 1)$ is zero; one thinks of $K(\Gamma, 1)$ as the quotient of $S(\bigoplus_{k \in \Bbb N} \Bbb R^{n+1}) = S^\infty$. In particular, the inclusion of this subcomplex induces an isomorphism on homology in degrees $\le n$. I cannot find a precise reference right now, but this is a long-established fact in the study of group homology.
To state the next proposition, observe that $K(G * H, 1) = K(G,1) \vee K(H,1)$ eg see here, so there is a natural isomorphism $H_n(G * H; A) \cong H_n(G; A) \oplus H_n(G; A)$.
Proposition 3. If $Y = [Y_1 \# \cdots \# Y_m]$ is a connected sum of $n$-manifolds for $n>2$, then $[Y] = \oplus_i [Y_i] \in \bigoplus_i H_n(\pi_1 Y_i;A)$, so is vanishing if and only if all $[Y_i] = 0$.
Proof: The relevance of $n > 2$ is to ensure $\pi_1(Y) = \pi_1(Y_1) * \cdots * \pi_1(Y_m)$. The natural map $Y \to Y_1 \vee \cdots \vee Y_m$ composes with the maps $Y_i \to K(\pi_1 Y_i, 1)$ to give the map $Y \to K(\pi_1 Y, 1)$, and the first map sends $[Y]$ to $\bigoplus [Y_i]$.
Corollary. If $Y$ is a closed oriented 3-manifold for which $[Y] = 0$, we have $Y = \#^m (S^1 \times S^2)$ for some $m \ge 0$.
Proof: We may write $Y = \#_{i=1}^m Y_i$ for $m \ge 0$ and all $Y_i$ prime 3-manifolds by the existence of a (unique) connected sum decomposition; the assumption $[Y] = 0$ implies $[Y_i] = 0$ for all $i$ by Proposition 3. A prime 3-manifold takes one of three forms:
- It is prime not but not irreducible, so $S^1 \times S^2$ (Hatcher 3mfd notes Prop 1.4).
- It is irreducible with infinite fundamental group, hence aspherical (Hatcher 3mfd notes Corollary 3.9a).
- It is irreducible with finite fundamental group, hence its universal cover is a homotopy sphere (Hatcher 3mfd notes Corollary 3.9b), hence it is a spherical space form (Perelman's elliptization theorem), hence quotient of $S^3$ by a free orthogonal action.
In the last two cases, the group homology fundamental class is nontrivial by Props 1 and 2, respectively. So we each $Y_i$ lies in the first case, and $Y = \#^m (S^1 \times S^2)$ as claimed.