The earliest you can get one is after the snowpoint gym (7th gym) and before the sunnyshore gym (8th gym). You will find it at the team galactic warehouse in veilstone city.
Or using the ability pick-up. (Levels 31-100)
And the last way to get one is trading from battle revolution for 7200 points.