Stealth rocks is normally taught on by a move tutor in previous generations. In Pokemon Sun/Moon I don't know how to teach stealth rocks to my Pokemon.
Sadly, there is No Move Tutor or TM for Stealth Rock. You can only get a Garchomp with Stealth Rock by transferring it from other games to Sun and Moon (Your Current Game).
Source : Serebii