As the title suggests, when did firearms technology develop such that the iconic rifle of the 18th and 19th centuries was no longer used, both in terms of militarily and for everyday hunting on the frontier.
When manufacturing became industrial, is the short answer.
The long, elegant American muzzle-loading rifle now called the Kentucky Rifle was a mix of styles: some German, some English, and a little French. The classic ones of the 18th c. Golden Age, circa 1780-1800, had tapered and flared barrels, often had well-engraved patchboxes and raised Rococo carving, all of which took good bit of time. But they also usually had imported locks- even at the time, those could be produced in specialty shops in England and imported at less cost than a more general gunsmith's shop could produce them. After 1800, there were further changes in the design that made it easier to produce: raised carving began to disappear, replaced by more and more decorative inlays- which were simpler to do. Barrels became straight, more often produced in special shops and sold as octagon blanks that could then be reamed to the finished caliber and rifled. In the 1830's, Henry and Leman of Lancaster PA had very big shops making pretty simple utilitarian guns, now commonly called Plains Rifles, with mass-produced Golcher locks. Fancy custom guns were still made, but typically the ornament would be in more inlays with more engraving. So, even with simple muzzle-loading rifles, industrial manufacturing was having an effect.
By the 1850's , breech-loading guns were becoming more and more popular. These were far more complex and required tooling and production machinery that a small gunsmith shop could not possess. After the Civil War the market was filled with breechloading guns using metallic cartridges, all made by factories. And though muzzle-loading rifles were still being made made and used, small gunsmith shops really could not compete against big companies like Remington , Colt and Winchester . The factories also had their own gunsmiths in-house who could do custom work. A pretty good marker would be the Creedmoor Match of 1874, between the US and Great Britain. The US team was supplied with breech loading rifles by Winchester and Remington, the British team ( actually Irish) used muzzle-loaders. The US won ( though the Irish would have done better if they'd cleaned their guns after every shot) and after that, in the US, target shooting was mostly dominated by breech-loaders.
So, after about 1870, a gunsmith was more and more often someone who did repairs, or could customize an existing gun. In this , he was like many other craftsmen. Blacksmiths stopped being the makers of hinges and latches, would instead be doing repairs, or sharpening drills for quarries, shoeing horses. Locksmiths stopped making locks, instead sold and repaired them, and made keys.
To add onto Bodark43's answer, a major technological development was the Minie ball in France.
Before its development, rifles were only really used by hunters, target shooters, and trained skirmisher units in the military. Breech-loading rifles couldn't be reliably manufactured with the metallurgy and accuracy needed to seal the breech from hot gases on firing, a problem that wouldn't really be solved until the metallic cartridge, so most rifles were muzzleloaders. These had to have a properly sized bullet carefully rammed down the barrel, which was in turn scrubbed clean after every shot or two if possible because of black powder fouling. Because this was impractical in battle, the military issued smoothbore muskets with undersized bullets that were inaccurate but could easily be rammed down a filthy gun.
The solution was the Minie bullet, invented by Claude-Étienne Minié in 1846. This was a conical bullet that was nominally undersized but had a hollow base (initially with a wood plug, but this was found to be unnecessary). Upon firing, the base would expand to grip the rifling. You now had a muzzleloading rifle that could be loaded as fast and easily as a smoothbore musket.
By the Civil War, the US had fully adopted the Minie ball. While both sides used old stocks, civilian weapons, and guns from commercial manufacturers both domestically and overseas to arm their armies, the Minie ball immediately made the Kentucky rifle and similar 18th century rifle designs obsolete. Combined with the increasing industrial manufacture of weapons and the development of reliable metallic cartridges and centerfire primers (allowing for stronger casings that could withstand more gunpowder than rimfire) in the 1860s, the long rifle was now primitive and quaint.