Your employer is not allowed to terminate your contract of employment simply because they want to avoid paying you Statutory Paternity Pay (SPP).
If your employer does this, and you would have been employed by them in the qualifying week if they hadn’t terminated your contract, and you have been employed by them for at least eight weeks continuously before your contract was terminated, then you will be viewed as having worked continuously for your employer up the child’s birth or placement with you for adoption.
In this case, your SPP will be calculated using your earnings of the 8 weeks immediately prior to your contract being terminated.