Ouch. It is really difficult. It seems like it’s unwise to mention it during the interview: there’s a big risk they’ll think “we really need someone in six months, but we can’t legally discriminate, so we’ll just pretend she’s not good enough”, even subconsciously. And the law is clearly on your side (especially because you’ll still be working at the same company).
OTOH, you don’t want to screw them over by waiting until the last second possible unless you’re sure your bridges are already burnt.
I’m not sure between telling them immediately you get the offer, or when you get the job, or a couple of months in. If you do hope to stay in the job, and you can half-way trust your manager it’s best to get in sooner so they’ll know, but if it’s a lost cause, obviously best not to and to hope for the best 
Responding to the offer seems reasonable, although I wouldn’t flat-out decline, I’d just say, “Thank you. By the way, there’s one more important thing you should know… Would you rather I started the job after I return from maternity leave?” or something. Then the onus is on them to decide if they can cope with it or not, but if they turn you down, you’ve a pretty clear case they did so illegally (if understandably), which may not help now, but in future you can point to it as you clearly being qualified when you DO want the promotion (or a job elsewhere). Hopefully they’ll accept you immediately or have someone cover. But honestly, if you turn it down, the chance of them being grateful later is really low: even if they honestly do think highly of you for it, the chances are someone else will be in charge in a year’s time and it’ll be worthless.
(Similarly, if you do agree an “acceptance but deferred start”, which doesn’t sound usual but might be possible, get an agreement in writing if you can, and if not, assume that they’ll be highly incentivized to stick with whoever’s been doing the job for the six months in the middle, rather than accepting you back, however good you are
)