In some places, a company can't just fire people because they feel like it. In Germany, where this is called a "Betriebsbedingte Kündigung"[1] you have to make a socially adequate choice based on how long someone has been at the company, whether they have kids, etc. and you also have to prove that there isn't an open position elsewhere in the company.
[1]: https://de.wikipedia.org/wiki/Betriebsbedingte_K%C3%BCndigun...