The Ancient West, also known as The Old West or The Wild West, was a period of history in the western United States of Earth, referring to the settlement of that region by Americans of European descent in the mid- and late 19th century. This period was frequently romanticized in Earth literature and other media, most often in the form of the American cowboy. Among those whose works contributed to this romanticizing were John Ford, Zane Grey, Larry McMurtry, Ernest Pratt, and Clint Eastwood. Such works were often called "Westerns".
In the mid-19th century, the Skagarans kidnapped several thousand humans from the western United States and brought them to a planet in the Delphic Expanse. In 2153, the Enterprise NX-01 discovered a number of their descendants living in settlements that resembled the towns of Earth's Ancient West. Not having room for that many people, and being on an urgent mission to prevent the Xindi from destroying Earth, the Enterprise crew left reference materials for the population, including works on recent Earth history (ENT episode: "North Star").
Beginning in the mid-22nd century, the Orions experienced a craze for 20th century Earth culture that included Westerns, after the UNSS Marco Polo sold them a number of Clint Eastwood movies and other cultural artifacts in reference stardate 0/7907.27 (c. 2150). They bought Western-style clothing, and imagined that 23rd century Earth was still inhabited by cowboys murdering Indians (FASA RPG module: The Orions: Book of Common Knowledge).
In the year 2266, Montgomery Scott used the word "romance" to describe the era. He used a time travel device to visit southern California on April 3, 1855. He materialized within a stagecoach just before it was robbed. He joined Billy Clancey and his outlaw gang in order to track down a stolen weapon called the N-cycle bomb, but Clancey stole Scott's phaser and used it to attack a wagon train. The trail for the bomb dead-ended with a patent medicine salesman in a frontier town. Scott later met Don Carlos' sister, whom he described as "the loveliest." (TOS comic: "A Bomb in Time")
In 2268, the Melkot created an incomplete recreation of the Ancient West town of Tombstone, and kidnapped Captain James T. Kirk and a landing party from the USS Enterprise to test them in a re-enactment of the legendary gunfight at the OK Corral (TOS episode: "Spectre of the Gun").
Kirk was also familiar with the "Western movies" of John Ford, and shared this familiarity with Spock. Years later, when Spock's friend David Rabin made reference to "Indians" as they were surrounded by nomadic natives of the planet Obsidian, Spock was able to connect the allusion to these motion pictures (TOS novel: Vulcan's Forge).
Ian Andrew Troi was a fan of stories of the Ancient West, a love which he passed along to his daughter Deanna (TNG episode: "A Fistful of Datas"). He was particularly fond of the novels of Zane Grey and Larry McMurtry, and was dismayed when his daughter developed a preference for the the program, an adventure series by Ernest Pratt (TLE novel: The Art of the Impossible).
In 2369, Worf, his son, Alexander Rozhenko, and Deanna Troi participated in a holodeck program, designed by Alexander and Reginald Barclay and set during the Ancient West in the town of Deadwood, South Dakota. Whilst running the program, an experiment being conducted by Geordi La Forge and Data malfunctioned, resulting in changes to the program ranging from characters in the program taking on the appearance of Data, to the holodeck's safeguards going offline, making the simulated 19th century weapons deadly (TNG episode: "A Fistful of Datas").
Following the destruction of the Enterprise-D, Worf took a number of holodeck programs with him, including one in which he portrayed an Ancient West sheriff tracking stagecoach thieves through the New Mexico desert. After transferring to Deep Space 9, Worf had both Jadzia Dax and Kira Nerys accompany him in this program (DS9 comic: "Unhappy Trails").