Making layoffs is never an easy decision for a company. When a company is forced to reduce its workforce, it is generally struggling to make a profit. Therefore, the first principle that the company needs to consider is who the employees vital to the operation are.
Ethically speaking, it is generally best to keep workers who have been at the company the longest. These employees have made a greater commitment to the company. And, the longer they have been with the company, the better the chance that they have more expenses, such as family, house, college, etc. It would hurt them more to lost their job than the younger employees. (Again, this is a generalization.)