In Generation 9, specifically S/V, Skarmory can only be taught the move Stealth Rock through the use of TM116. This item can be found a) in South Province (Area Five), atop the large plateau, and b) via the TM Machine for 5,000 LP, 3 Rolycoly Coal, and 3 Rockruff Rock.
In Generation 8, specifically SwSh, Skarmory can only be taught the move Stealth Rock through the use of TR76. This can be obtained from the Watt Traders for 3000W. According to Bulbapedia, Watt Traders can be found in the following locations:
- Meetup Spot
- East Lake Axewell
- Dappled Grove
- Giant's Seat
- Bridge Field
- Hammerlocke Hills
- Giant's Cap
In Generation 7, specifically SM, Skarmory can only be taught the move Stealth Rock through breeding. Compatible parents can be found here. In USUM, Skarmory can additionally learn Stealth Rock via the Move Tutor at Heahea Beach on Akala Island for 8 Battle Points.
In Generation 6, specifically XY, Skarmory can only be taught the move Stealth Rock through breeding. Compatible parents can be found here.
In Generation 5, specifically BW, Skarmory can only be taught the move Stealth Rock through breeding. Compatible parents can be found here. In BW2, Skarmory can additionally learn Stealth Rock via the Move Tutor in Nacrene City for 10 Green Shards.
In Generation 4, specifically DPP, Skarmory can only be taught the move Stealth Rock through TM076. Roark gives you this TM after you beat his gym in Oreburgh City.
In Generation 2 and 3, specifically GSC and RSE, Skarmory cannot be taught Stealth Rock, since the move did not exist yet, so if you want your Skarmory to have that move, you need to move it to a different game.
Skarmory did not exist in Generation 1.
Source: Pokemon DB pages for Skarmory's movepool in each generation
Hope I helped!