I already voted for the responses above, but this really needs more explanation. Yes, the standard is 18 holes because of St. Andrews, but it actually wasn't that everyone decided to copy St. Andrews. In 1860, after the club pro at St. Andrews (who was considered to be the best golfer in Scotland) died the year before, another course (Prestwick, whose club pro was Old Tom Morris, who had also built the 12-hole course -- and who thought he was now the best golfer in Scotland) decided to organize a tournament to determine the best golfer, which it called The Open (now sometimes called the British Open). Basically, the tournament consisted of three trips around Prestwick in one day (thus, 36 holes), and to encourage people to come back, the tournament had a rule that, if anyone won the championship belt three years in a row, he could keep it and be proclaimed the best golfer in Scotland. The tournament generally came down to a battle between Morris and Willie Park, Sr. from St. Andrews (Morris won four and Park won three of the first eight). But then Tom Morris's 17-year-old son, called Young Tom Morris, started playing in the 9th tournament, and he immediately won it three straight years. End of tournament, we now know who the best golfer in Scotland is, thanks for coming, have a nice life.
Except. . .
Golfers had liked the tournament. A lot. And they didn't like the fact that there wasn't one the next year. So there was a meeting called between the governing bodies of the three premier courses in Scotland: Prestwick (12 holes), St. Andrews (18 holes), and Edinburgh (who played at but didn't own an 8-hole course called Musselburgh, where they had moved when their 5-hole course at Leith Links became overcrowded). The three groups decided to contribute for a new trophy and to rotate the tournament between them in the order Prestwick, St. Andrews, Edinburgh. But how to make it fair when they all had different numbers of holes? The solution was clear -- standardize the tournament at 36 holes, which would mean building an extra hole at Musselburgh, and then play three rounds at Prestwick, two rounds at St. Andrews, and four rounds at Musselburgh. And that's exactly what happened from 1872 to 1889. But, as the tournament became more popular, all three groups realized that it was easier to play two rounds in one day at St. Andrews than three rounds in one day at Prestwick or four rounds in one day at Musselburgh. So Prestwick bought more land and had Old Tom Morris build six more holes in 1882, making it the same size as St. Andrews. Now, starting in 1884, it only had to be played twice, just like St. Andrews.
But Musselburgh couldn't get any more land. So the Edinburgh Company bought its own land after the 1889 tournament at Musselburgh ended in darkness and built a new course, which it called Muirfield. It had Old Tom Morris design the course at 18 holes, so it would match both St. Andrews and Prestwick. Thus, The Open would now rotate among three 18-hole courses. And other venues that were building courses realized that they had to build 18-hole courses to be able to host The Open, which became a real issue when the Edinburgh Company had to boost the prize pot for 1892 from £ 25 to £ 100 (with a winners share of £ 30) to fight off competition from the jilted Musselburgh, which planned to hold a tournament on the same date and offer a prize pot of £ 30. (To afford that, Edinburgh increased the tournament to two days, or 72 holes, and it has remained there ever since.)
The prize money escalation forced the organizers to allow other courses to host in return for a financial contribution, albeit with the stipulation that they had to be 18 holes as well. And sure enough, first St. George's in England (built in England at the same time as Muirfield and soon designated Royal St. George's) and then Royal Liverpool in England (built by Old Tom Morris' brother and expanded to 18 holes even before Prestwick) joined the rotation. The idea that a meaningful tournament had to be played on an 18-hole course and consist of 72 holes became standard. But it wasn't just to imitate St. Andrews but rather that the three courses had to standardize the number of holes played. [For what it's worth, The Open remained a two-day tournament with 36 holes per day until 1926.]
https://en.wikipedia.org/wiki/The_Open_Championship