What a bastard. What a seriously selfish, self absorbed bastard. I won't call him a man. I'll call him an it.
O.P. believe me, anyone who waits until you are 5 months pregnant to drop a bombshell like that on you is not worth one tear, or any words from your lips.
You are worth more than that. No one should be treated like this.
Of course you feel like the bottom of your world has fallen from under your feet and you will feel numb, depressed and shocked, I have been where you are and it takes lots of time, but believe me you will emerge stronger.
Do not give 'it' any time. At all. Give it the cold treatment, only talk when strictly necessary and then leave it brief. DO NOT beg him to come back, ask for answers, or show how upset you are. Resist any of those temptations.
Believe me 'it' will start to reassess when you act like you couldn't care less if 'it' died tomorrow.
Also, do not start thinking about what you might have done wrong. Your self esteem has taken a serious bashing and the voices in your head will start putting you down. You did nothing worng and there was nothing you could have done to prevent 'it' taking the course of action 'it' has.
Pamper yourself everyday, and lean on others who are willing to give support.
Thinking of you.