Is recruiting younger employees legal?

I don't know much about the hiring part, but one place I have worked it was very difficult for managers to fire any employee who is up there in age. HR just finds an excuse to not fire them almost no matter what they have or have not done.