Here is series of groups where the property holds, even if the subgroup is not normal.
A subgroup $S$ of a group $G$ is called subnormal (one writes: $S \lhd \lhd G$) if there exists a chain of subgroups $H_i$ of $G$, with $S=H_0$, $H_{i-1} \lhd H_i$, for $i=1, \dots, r$ and $G=H_r$.
Proposition. Let $S \lhd \lhd G$ with index$[G:S]=n$. Then for all $g \in G$ it holds that $g^n \in G$.
Proof. Choose subgroups $H_i$ with $S=H_0 \lhd H_1\lhd \dots \lhd H_r=G$, and put index $[H_i:H_{i-1}]=n_i$, $i=1, \dots , r$. Then $n=n_1\cdots n_r$. If $g \in G$, since $H_{r-1} \lhd H_r$, $g^{n_r} \in H_{r-1}$. Since $H_{r-2} \lhd H_{r-1}$, $(g^{n_r})^{n_{r-1}}=g^{n_rn_{r-1}} \in H_{r-2}$. Now continue this argument till $S$ is reached. $\square$
Since nilpotent groups are characterized by the fact that all subgroups are subnormal (this can be proved by the “normalizers grow” principle and induction), the proposition allows for a series of examples of a group $G$ and non-normal subgroup $S$, with index $[G:S]=n$, such that $g^n \in G$ for all $g \in G$. For example, take $G$ a $p$-group and $S$ any *non-normal* subgroup. Smallest example: $G=D_4= \langle a,b:a^4=b^2=1,bab=a^{-1}\rangle$, with $S=\{1,b\}$, which has index $4$.