It used to be that people bought their phone under contract from their phone company. By signing an agreement with their telco which covered a couple of years, people secured themselves the latest iPhone and enough minutes and data to keep them going. When the contract was up, they upgraded to a new phone and the whole thing began again.
At the time, this sort of deal made sense. The phone companies, keen to grow their business, heavily subsidised the cost of the phone. Since a new device often cost hundreds of dollars, this prevented new customers from being deterred by a high up front cost. The 24 month term allowed the price of the phone + plan to be an affordable monthly payment.