Sure, miniature golf existed before the Twenties, in a few places where golf courses offered a smaller version for ladies. These were on grass, like the real thing, and involved playing with a putter and perhaps a short driver. It was called various things: garden golf, par 3, and pitch and putt.
But what we think of today as miniature golf, with the fake grass carpet and fanciful props, began in the Twenties when a golf fanatic named Thomas Fairbairn developed artificial green that made it possible to put a miniature course just about anywhere, including rooftops. (One source claims there were more than 150 rooftop courses in New York City by the end of the Twenties.)
Mary Pickford dedicated a Wilshire miniature golf course in Hollywood in the Twenties. Maybe it looked like this one in Rochester, NY, that claims to be the oldest miniature golf course in America. It was designed in 1929 and opened in 1930. I guess they were able to prove it, because it earned a place on the National Register of Historic Places in 2002.