You buy it in the Battle Frontier for 32 BP.
You can also get it (if you have SS or HG) below GoldenRod
City if you go left from the breeders house in to the water
You will have to battle 3 trainers first.
You get it as a prize.