The earliest apartments: Roman insulae
As far as I can tell, the oldest apartments — multi-family multi-story dwellings — were built more than two millennia ago, in the Roman republic — and they are spookily modern. Our best evidence comes from Ostia:

Ostia Antico, layout
Back then, cities were bounded by walls. Land inside them was valuable. But the workers – shopkeepers, laborers, maids, housekeepers, stevedores – had to live close to their jobs. Roman law – the first zoning of which I am aware – limited building height to the equivalent of fifty feet. So floor space was at a premium. Enter the insulae.
By the end of the 1st century BC, a growing pressure for land in many larger, overpopulated cities gave rise to the insula, or apartment. The term insula had originally been applied to rectangularly shaped town building plots. 6-8 apartment blocks could occupy one insula, and were usually designed around an open courtyard. However, with most apartment blocks being three stories high, at least, this simply became a light well. Shops usually fronted the streets at ground level.

A typical large insula at
“The immense size of

No room to spread out!
Built of brick, probably unplastered and little ornamented, they were entered from exterior stairs that led up, over a ground floor of shops, to corridors off which opened single rooms that were numbered. Each room had its own window of mica or selenite, translucent enough to remind you morning had arrived. Some rooms had small balconies for taking the evening air (and disposing of garbage and night soil).

Despite variations in quality and allegations of questionable safety and sanitation, the apartment block became the most common form of Roman housing, as families began moving into rented spaces owned by landlords.
Most apartment blocks were made with timber and mud brick, making them prone to fire and collapse. The upper floors were without heating or running water and only sometimes had lavatories. Later designs seemed to have been built more safely, with fired brick and concrete, but there were no other improvements as far as sanitation and standard of living.
Apartments outnumbered domus style town houses more than 25 to 1 in the fourth century, remaining the main type of housing until the end of the empire.

Typical facade, larger building

On the street, there are usually several shops and several separate entrances where the doorways give access to the extra select apartments above. But most tenants have to go through the central portal. Upon entering they will find themselves in a courtyard upon which open many windows of the tiers of rooms in the upper stories.
From the courtyard, several staircases rise to the tenements above. In the apartments on the first floor are the more comfortable suites, each with a series of rooms. The quality falls rapidly as the tenants scale higher. Juvenal writes, “If the (fire) alarm goes at ground level, the last to fry will be the attic tenant, way up among the nesting pigeons, with nothing but tiles between himself and the weather.”

As cited in Peter Hall’s mammoth Cities in Civilization (Amazon US, UK) about
The Aventine Wall enclosed 426 hectares [Roughly 1½ square miles — Ed.], a mere one-sixteenth of the area of the modern city of
Public safety mandated the first building codes:
In fact, from the Republic onwards the Romans found it necessary to make regulations to control the thickness of walls, the quality of building materials, and the roofs and height of buildings.
Enforcement must have been a problem, for there seems to have been no requirement to notify the authorities, as opposed to possibly interested third parties, of any proposed new structure. Since there was no mechanism to require planning consent, any initiative had to be taken by some interested party.
So, despite these edicts, new apartment houses continued to be built five or six storeys high. Small wonder that, excavated and reconstructed, this commonest type of Roman building appears startlingly modern.
…the insula or apartment block came to dominate the entire city: catalogues from the fourth century AD record 46,602 insulae as opposed to only 1,797 single-family residences, domi.
… In fact, the insula became the standard form of Roman middle-class as well as working-class housing; and not merely in

Flats over shops,
Commonly, the streets carried continuous rows of open shops (tabernae) under several floors of tenements. The loft above the taberna containing one habitable room was used for the lodging of the storekeeper, the caretakers or the workshop employees. In an alternative type the ground floor was used as a domus or private residence. Within each block main staircases generally led to the upper floors independently of the shops. On these higher floors the windows facing the street often had extending balconies with bases of brick-faced concrete. Each floor had a lavatory and chutes for rubbish disposal. Behind was a court, which provided light, and a place for a water cistern supplying a communal tap. A few large blocks had arcaded courtyards like Italian Renaissance palaces; for these blocks housed both rich and poor.
The typical apartment in an insula had different rooms, segregated (as in a domus) by function: the cubiculum or bedroom, the exedra or living room, and the medianum or central hall, giving access to all rooms in the house; poorer people, living in kitchenless apartments, had to cook in the medianum (where the smoke could escape through the many windows) and eat there. In
Because the insulae housed perhaps nineteen out of twenty Roman families, like their Parisian equivalents nineteen centuries later, they provided accommodation of every kind, from dark little single rooms several flights up, to luxurious duplex apartments on the more desirable lower floors. One scholar argues that the excavated ruins give a false impression: they represent only the best buildings and are not typical at all of the cheaper, flimsier blocks which, from contemporary reports, were far more common. Their wretched inhabitants had distractions in the form of theatres and circuses; but the splendid public buildings can hardly have compensated for the squalid realities of everyday life.
Slums are economically rational, and in ancient times the law of economic gravity met the law of gravity head on:
First, apartments were mostly built with wood frames; and they were so high and poorly built that they were in constant danger of collapse or destruction by fire. The foundation usually covered 3,200-4,300 square feet, inadequate to carry a structure 59 to 65 feet high; thus it was always liable to collapse. Even after brick construction had been perfected and had become usual in the second century AD, the city was constantly racked by the noise of buildings collapsing or being torn down to prevent collapse; the tenants of an insula lived in constant fear of its coming down on their heads.

Decimus Junius Juvenalis, AD 60-140 (?)
Juvenal [A satiric poet, and thus not entirely reliable. — Ed.] gloomily reflected: ‘Who at cool Praeneste, or at Volsinii amid its leafy hills, was ever afraid of his house tumbling down? … But here we inhabit a city propped up for the most part by slats: for that is how the landlord patches up the crack in the old wall, bidding the inmates sleep at ease under the ruin that hangs above their heads’.

The streets of Ostia Antico are still evocative today.
