In X/Y, you must do the following to get Bastiodon with Stealth Rock:
- Have a Female Shieldon/Bastiodon breed with a Male Tyrunt/Tyrantrum which knows Stealth Rock (it get's that through level up)
- Get the Egg and hatch it. You should get a Shieldon with Stealth Rock then.
- Evolve it and you have a Bastiodon with Stealth Rock.
In Black 2 and White 2, you can take the Bastiodon you want the move on to the move tutor in Nacrene city. Give him 10 Green Shards for the move Stealth Rock, and teach it to your Bastiodon.
In Diamond, Pearl or Platinum, as Stealth Rock is a TM, you can teach it to Bastiodon directly.
Hope I helped!