The system of leasehold property ownership in use today is a relic of English property law dating back to the 11th Century. The term 'Freeholder' (which effectively means full, outright ownership of land) was used in the Doomsday book of 1089 and the first 'Leasehold Estates' appeared a few decades later in the Middle ages.
Medieval (feudal) Law wasn't concerned with hardworking families trying to get on the property ladder; Land equated to power in the middle ages and powerful families wanted to retain ownership of their land while maximising their earnings from it. The concept of leasing was established to allow 'villeins' or 'surfs' to work a plot of land, for a fixed period of time, on the basis that they would pay 'in-kind' by providing food and services to those further up the social order.
Fast forward to the 1920's; Landowners (freeholders) still had a dominant position over their tenants, but during this period various Legislation/Rent Acts were introduced to hold-down rents and restrict the right of landlords to evict tenants. Many landlords, facing dwindling profits, started to sell long leases (typically 99/125 years) of their properties - houses and flats - as a means of bringing in more money, without losing ownership of their land/property. This was the beginning of the modern leasehold system that we know today.
The increase in construction of Flats from the 1950’s onwards caused leasehold ownership to increase significantly. In that period, leasehold was the only means available to subdivide and sell properties in a multi-occupancy building. Freehold ownership couldn't be applied to Flats, as the relevant freehold property law requires a separate land boundary visible on a map - not possible for a tower-block of flats which share the same plot of land.
Leases were originally sold on the basis that eventually, when the lease expired, ownership of the land & property would revert back to the landowner/freeholder. However in practice there was a public outcry in the 1960's when long-standing elderly tenants, who had little understanding of the legal process, were threatened with eviction when their leases ran out. This prompted further law changes to protect leaseholders (see below), but even with these robust legal safeguards in place, the effect of seeing leaseholders losing their homes and in some cases being pushed-out onto the street, is the reason why some (older) people are still very wary of purchasing leasehold property.
Even today, leasehold is by far the most common form of flat ownership and it's still possible in 2018, for a lease to expire, a tenant to be evicted, and the property to revert back to the freeholder. But the leaseholder would have to be asleep at the wheel for decades to allow that to happen. Legislation introduced between 1967 and 2002 has rebalanced the relationship between freeholder and leaseholder, allowing owners of leasehold houses (from 1967) and flats (1993) to extend their leases for an additional 90 years (amongst other rights) and to put the security of their leasehold tenure "to bed", effectively for the lifetime of their property.