The two big main ones I can think of.
They provide short term housing. If your only planning to say 1-2 years in a location it often doesn't make much sense to buy a house.
They also take on all of risk of the property.
Obviously I am not saying landlords are the greatest thing in the world but they do serve a purpose.