Basic purpose of notice period (for employer) is that the organization can have enough time to find a replacement and notice period serving employee can train the replacement for that particular position. Notice period do not give rights to management to discriminate employee and arbitrary make such policy which are against the basic rights of employees.
Organization should [must] not indulge in such practices. It’s not only illegal, unethical but it can lead to culture where employee leave organization without serving the notice period and it can also hamper the image of organization. This will have more devastating effect on organization in long run and I think no management want this.