Calendar you are not being discriminatory, and yes this is a good place to come for advice.
This is a genuine problem, you are not attempting to deny the employee any of her rights, but that doesn't mean it isn't a difficult situation for you to deal with.
She won't be entitled to any maternity pay if she is already pg and hasn't started employment yet - as nailpolish says you need 26 weeks service by 11th week before you are due, i.e. by 29 weeks pregnant, so you need to have been in employment before you actually get pregnant.
She will be entitled to maternity allowance.
Best thing you can do is sit down with her when she starts, and look at the situation together and work out how to make the best of it. Confirm to her what she is and isn't entitled to, have a look here, discuss with her the best way to approach her work over the next 6-8 months. She will have valid opinions as well about the best thing to do for both of you. You may get a sense from her as to whether she has any intention of coming back, but she has absolutely no obligation to make any decision about this so don't push it, but if she volunteers her initial intentions that may help with your planning.
You mention that this is a trainee post - be careful not to deny her any training she otherwise would have received, this would be discriminatory.
Similarly don't give any indication yourself about what scope there maybe for p/t working etc. It's far to early yet and you don't want to give any indication that it would be fine as it may not - that's a long way off anyway.
You have a commendable attitude compared to many employers. At one organisation I worked with I had a telephone call from a senior (female) director who was in the same position, and said she was just ringing me to 'confirm I don't need to stick to our offer of employment now, do I?'.
It's not an ideal situation for all concerned, but she can still be a committed and valuable employee over the next few months, and will have plenty to offer. And if you fulfil your obligations and also best practice as an employer, she will be more likely to come back as well.