Quite simply, not every girl has a hymen, and even for some who do the hymen is stretched by everyday activites such as sports or horseback riding.
The hymen is rarely a complete obstruction, more commonly it is perforated to allow menstrual blood to flow through.
Sperm ejaculated inside the rectum during anal sex can not cause pregnancy.
The sperm has to get into the vagina.
However, the sperm can drip from the anus to the vagina.
Always use condoms to limit the chances of such occurences.