Your employer is not allowed to discriminate against you because of your pregnancy (or because you are on maternity leave). Being dismissed because of pregnancy is automatically unfair, regardless of how long you have worked for your employer.
This does not mean that you cannot be dismissed or made redundant for any reason. For example, you could be dismissed for stealing from your employer. You could be made redundant if you were chosen for redundancy in a fair way that had nothing to do with your pregnancy.
But you cannot be dismissed or made redundant because of your pregnancy, for example because:
You need time off for antenatal care.
It is no longer safe for you to do your job (the employer must find you alternative work, or put you on paid leave).
Your employer doesn’t want to pay you maternity pay and also pay for cover.
You suffer from a pregnancy-related illness.