Disclaimer: The following has nothing to do with what is morally right and everything to do with what might have been evolutionarily programmed into us. It is not a valid excuse for any form of sexual misbehaviour, nor is it intended as such!
In the primeval environment that shaped the ''programming'' for our sexual behaviour, there might have been an advantage to be had in mating with teenagers and younger women, even if the ensuing pregnancy was riskier, since it would be less likely at that point that they had mated with anyone else. A man would be more likely to know for certain that the child was his and that he wasn't investing time and energy in someone else's genetic legacy. If another guy then becomes that woman's long-term partner, they might even raise your kid by mistake. This might also explain the fixation seen in several cultures with marrying or having sex with virgins.
Your point that teenage pregnancies are more dangerous, is valid, and evolution would probably try to strike a balance between the above lines of reasoning and creating a safe pregnancy. If porn search data suggest men appear to be most attracted to 16 to 17-year-olds, maybe that is the point of balance - the most evolutionarily favourable age to be attracted to, on average.
Repeated disclaimer: Having sex with 16 to 17-year-olds is a terrible thing to do in nearly all circumstances, and I am not condoning it! The only point I make here is that it could possibly have once been evolutionarily favourable.