The Old Course at St. Andrews originally had 11 holes, but a round involved playing them out and back, creating a 22-hole round.
Combination of holes:
In 1764, golfers decided to combine the four shortest holes into two, resulting in a round of 18 holes.
The standard takes hold:
At the time, this was a change specific to St. Andrews. However, as golf gained popularity, and with the influence of the Royal and Ancient Golf Club of St. Andrews, the 18-hole round became the de facto standard for courses in Scotland and eventually across the world.