It's quasi-legal. You can be "fired" for all sorts of reasons, but in making a post redundant the employer can't then rehire for that position, if large numbers of posts are being made redundant then there needs to be consultations etc.