There is a legal distinction between firing and layoffs. Firing is done for cause, while layoffs are to reduce costs. The rights of the workers are different in those cases depending on local laws.
I'm not a lawyer, but I believe there would be no legal ramifications for firing someone this way unless it were used in a lawsuit to show that the company acted maliciously.