The ISS is by no means the first human habitat in orbit, but was in fact the 9th such space station. In the 1970s and 1980s, the USSR launched a whole series of relatively small Salyut space stations, while the USA put the somewhat longer-lived Skylab into orbit.
A major step forward came with the USSR (and latter Russian) Mir space station, which introduced the idea of modular components launched separately and connected in space, allowing the construction of a larger station. The series of rockets required to build such a station also naturally encouraged restocking with supplies in an on-going way, so it is perhaps unsurprising that Mir had a large number of crews over its 15-year lifetime, some of long duration; Valeri Polyakov, who spent 437 days on Mir, set a record for a continuous stay in space.
The USA, Russia and Europe were all looking at following up on Mir’s success with further space stations, but ultimately joined forces to collaborate on the ISS project.
And currently there is a second space station in orbit, as China has launched the Tiangong I module as a testbed for its own plans for a large space station.
The relative sizes of the different generations of space station shown to scale (adapted with kind permission from a graphic produced by Richard Kruse for historicspacecraft.com)