OP the timing isn’t perfect but I understand why you feel the need to tell him now. You are pregnant and highly emotional and perhaps it’s more of wiping away the past for a ‘clean slate’ when the baby arrives.
You were at uni, very young and tbh I don’t think the first ONS was even cheating as you weren’t together.
Yes, you should have told him about the other one at the time but you obviously didn’t feel that strongly about him or you wouldn’t have done it. My guess is, though, your relationship developed and feelings strengthened and the longer you haven’t told him, the guiltier you’ve felt but the further away from the incident it becomes and so you chose not to tell him and to focus on your relationship.
I think, for him, after the initial shock of the ONS, the biggest betrayal will be that you kept it hidden for all these years. Don’t be surprised if he finds it difficult to trust you for a long time, questions you, brings it up etc. His feelings will be hurt by the perception that you have lied to him for all this time.
If you both want to get through it, you can but you need to be as patient and reassuring as possible- which is difficult anyway, never mind when you’re pregnant and should be the one whose needs are prioritised. My suggestion is give him time to think for a couple of days and let him decide, on his own terms, what reassurances he needs from you to continue the relationship. Then do your best to meet them. Perhaps also try couples counselling if you can afford it.
It’s going to be tough OP but people have gone through tougher and survived. Good luck.