Consider the infinite dihedral group $G=C_2*C_2=\langle a,b \mid a^2=b^2=1\rangle$ where $C_2$ is cyclic of order 2. It has a finite index (2) infinite cyclic group $H=\langle ab \rangle$ which is also (almost) the derived subgroup of $G$ ($G'=\langle (ab)^2\rangle$). Then $H'$ (trivial group) is of infinite index in $G'$.