You are not the first person that this has happen to and you will not be the last, either. You do need to have a serious chat with your doctor about ways to manage this. You could wear some protection so that if this happens you will not soil your bed and you can go on a schedule of bladder emptying so that you maximize your bladder control. But you have an ongoing issue with bladder frequency that you need to address. It will not get better as you get older, so it would be best to start to address this now.
One of the other posters suggested that you contract your OB/Gyn and that is a good suggestion. If you have a Uro/Gyn specialist that would be even better. Some of this may be related to your hormone levels.
To start with here is something to try while you decide where you are going from here. Have your last fluids at dinner time. That way your body will have processed them by the time you are ready for bed. Empty your bladder just before bed. Get 7-8 hours of sleep so that you are not so tried that you can not wake when you need to get up to empty your bladder should you get the urge during the night.
Hope this helps and please continue to chat with us.
gentle hugs; you are not alone.