Before he abdicates, of course. Then he can just abdicate in favor of the child. Yes this is impossible OTL I know
Well it kind of is impossible
The act of Settlement 1701 and act of Westminster 1931 pretty much codifies it into being Parliament (and constituent countries) that decides who comes next if there is an abdication
But even before that it's pretty much the person abdicating is being forced to and is told who they are abdicating for (e.g Mary Queen of Scots, Richard 2). But a voluntary abdication is a first here
Thing is even without those acts, the problem here is the "scandal" of divorce and how it interacts with the crown and being head of state/church, will still be an issue for any kids from the marriage (Wallis will still be the mum after all)
Also there will be no children for Edward to abdicate in favour of? No way is the state going to hold the crown waiting for a child to be born especially as Wallis is what 41 when they marry.
Sorry I just realised the above isn't very clear, They won't let him marry Wallis without abdicating first, so he would have to abdicate prior to marrying Wallis in favour of a child of that marriage that wasn't born yet