Marrakech is a city in Morocco.
North towards Casablanca, Rabat
From the train station, walk north along the road following the signs for Casablanca in order to hitchhike. The city goes on for a long ways, but there is a wide spot in the road next to a petrol station where it is possible to thumb a ride to a wide spot in the road at the edge of the city.
West towards Essaouira
From next to the train station, take a bus L22 along the street Av. Hassan II (it costs around 60MDH). Get off when you see a big supermarket and a Afriqua petrol station on the right. It takes about 10 minutes and you're a bit outside the town then. There is a number of roundabouts and parking space, so the cars are passing slow. You can supply yourself in the nearby large supermarket. And the direction is clear, many cars will go to Essaouira.
South towards Ouarzazate through Tizi'n'Test
You can walk two kilometres to the road from Bab Debbagh or can take grand taxi or minibus (6dh) to the nearest village Ait Ourir. They also have stop near Bab Debbagh.
South towards Imlil, Atlas Mountains
Walk to the gas station where the grand taxis wait by road Rue Lalla Rkia. Follow this street until you reach the main road R203 and begin to follow this road. With a sign and finger waved it should take no longer than 30 minutes to find a car/van willing to take you to either Asni (enroute) or Imlil. It should cost 15-25dh to Imlil. If you can only make it to Asni, there is a local mini bus that will take you to Imlil. It will cost 10dh per person maximum. Hitchhiking to Imlil from Marrakesh will be quicker and cheaper than catching a grand taxi.