What is the purpose of repainting the walls of an apartment?
In some areas, such as rent controlled communities, there may be
  requirements for landlords to paint rental properties. In New York
  City, landlords must paint every three years, while in West Hollywood,
  landlords have a four-year requirement. [source]


The implication seems to be that landlords are required to paint simply as a measure to prevent decay of the property and poor or unsanitary conditions for tenants. 

More reading