You should have told him before you had sex with him, before your relationship was serious and definitely before you had kids.
You were 16/17, very young, you should have had a home & family supporting you, but clearly you didn’t. I think it’s sad that your ‘friend’ encouraged (pushed ?) you into doing it and that possibly you didn’t think you had much choice. I have no moral objection to adults choosing to do it, but I hate the thought of a young girl doing it because she doesn’t have a home & family
It’s nothing to be ashamed of, but I think you (as in everyone) owe your partner the truth about your life. Now, lots if people disagree with that, that’s their choice, but if a partner lied to me about important stuff I wouldn’t be at all happy. It could well be relationship ending. Not what the lie is necessarily, but that they lied.
Only you know your partner and what’s best to do in your situation. Though, given you were 16, I’d be rather disappointed in him if he didn’t just feel sad you’d gone through that and sorry that you didn’t feel you could tell him much much sooner in your relationship. But I’d understand if he felt betrayed by your lies re previous sexual history.
If I were you I’d tell him though, because I couldn’t relax knowing that he might find out from someone else and that would be far worse.
It’s a decision only you can make.