Riding becomes available at level 20. To pick it up, travel to your race's home city — Stormwind for humans, Sen'Jin Village for trolls, and so on — and speak to the riding trainer. The training itself costs roughly one gold.
The mount vendor stands right beside the trainer, and the basic mounts are inexpensive. From there, higher riding ranks unlock as you level:
And with the Cataclysm expansion, flying was extended to the old continents as well, which had been ground-only up to that point.