For which groups does existence of a subgroup of prime index $p$ implies the existence of a subgroup order $p$? Subgroups and quotient groups are very different things, but when $G$ is finite and has a quotient group $Q$ of order $p$ with $p$ prime we know from Cauchy's theorem (or the stronger, more famous version by Sylow) that $G$ also has a subgroup $H$ of order $p$. (Here I have no pretensions as to elements of $H$ being representatives of elements of $Q$ although results in that direction would be nice too)
My question is: is there a more general class of groups than just finite groups for which this implication (subgroup of index $p$ implies subgroup of order $p$) holds?
The example of $\mathbb{Z}$, the infinite cyclic group shows that this property is not automatic, but still I am cautiously optimistic about compact topological groups. And what is known about reductive algebraic groups?

The $p$-adic integers are a torsion-free compact topological group with a quotient of order $p$.
