The short answer
Not a through bus. CTM and Supratours coaches run from Marrakech to Ouarzazate and to Errachidia, but not to Merzouga itself. From Errachidia you continue by grand taxi via Rissani or a camp pick-up. Our guide puts the whole chain at 11 to 14 hours with several changes. There is no train south of Marrakech.
In more detail
The coach to Ouarzazate takes about 3.5 to 4 hours over the Tizi n'Tichka. The coach to Errachidia, over the northern pass, takes about 7 to 8 hours. From Errachidia a shared grand taxi runs to Rissani, and from there another short hop or a camp pick-up covers the last stretch to the dunes.
It works, and people do it, but it is a long and wearing day, and it skips everything that makes the southern route worth driving: no stop at Aït Ben Haddou, no time in the gorges. If you want the Dadès and Todra as well, the bus network largely gives up beyond Boumalne, and you are on grand taxis that do not keep a timetable.
A private driver from Marrakech is the simpler way, and it lets you stop where you like. If you are set on public transport, give yourself a night in Ouarzazate or Errachidia to break the journey.
