It is against the law to discriminate against anyone because of being pregnant.
Read the Acas guide on pregnancy and maternity discrimination for more information.