The earliest idea of a National Park Service in the U.S. is attributed to American Painter George Catlin during his travels around the 1830s. Catlin specialized in painting portraits of Native Americans, and believed that the Government should protect their lands, and preserve natures beauty.
His ideas went largely ignored however, and it wasn't until the 1850s, and the actions of two men, James Hutchings, and Thomas Ayers. Hutchings was publisher, and began leading tourist expeditions to Yosemite Valley, and hired Ayers, an artist, to create illustrations of the valley for Hutchings California Magazine.
Hutchings worked constantly to promote the Valley, and with Ayers illustrations, Yosemite proved extremely popular in the east, which led to a movement to protect it. In 1864 then president Abraham Lincoln signed a bill granting the state of California ownership of Yosemite Valley, and the nearby Mariposa Grove, for "for public use, resort and recreation".
However, it wasn't until two years later that the state actually set up administration to run the park, and there was an 11 year long legal battle involving homesteading claims in the valley. In addition, problems with building hotels, building the Yosemite Valley Railroad, and several other problems under state ownership led to Yellowstone National Park becoming the first true National Park before Yosemite was complete.
One big promoter of the national parks, yellowstone in particular, was the Northern Pacific Railroad company, which wanted more destinations throughout Wyoming and Montana.
Another source of support was the US Federal Army. Which built forts throughout the early parks in order to stop poaching, and other illicit activities from taking place there, and were also in charge of general security and management. Eventually, they would be replaced by state controlled park rangers.
Following this, the Antiquities Act of 1906 was created to protect objects of scientific and public interest. This gave the President the ability to declare locations, both natural and man-made, to be National Monuments, beginning that same year with Devils Tower, as proclaimed by then president Theodore Roosevelt.
Ten years later, the National Park Service Organic Act, was signed into law by then president Woodrow Wilson, which created the National Park Service proper, and set a standard for maintaining national parks, monuments, and historic places.
As for why it didn't happen sooner? Well, public opinion mostly. During the 19th century there wasn't much desire for public lands. After all, the majority of people didn't travel, and there weren't a lot of ways to get to these places. But as railroads were built, technology improved and cites and wealth grew, so too did the desire for a more natural environment. The seeds were planted early too. Yosemite Valley was created fifty years before the national park service was created, and when that proved popular others followed suit. It wasn't until the system grew too big that a standard was necessary.