It takes 6 hours on the direct, first-class or Platinum ADO buses. Here is a website giving the schedules and prices (in Spanish only)
You would leave from the TAPO bus station, which is not far too from the airport.
Our experience is that the buses (particularly the GL or Platinumj are more comfortable than an airplane, the drivers ar very professional, and the scenery through the mountains is beautiful.
it takes about 6 hours by bus and by air only 35 min, check out airlines for schedules and prices like low cost vivaaerobus
Two points of clarification:
1) Viva Aerobus no longer flies into Oaxaca from Mexico City (check the website, and if anyone can confirm different information, please point me to the appropriate link), and in any event it has been a very iffy airline in terms of reliability.
2) The first class buses take a minimum of 6 hours, and usually upwards of 6.5 hours, depending on hour of departure. Go with Platino if you can afford it.
Alvin Starkman - Casa Machaya Oaxaca Bed & Breakfast