The fastest and most comfortable way to get between the two cities is by private transfer, which takes just 3.5 hours. There is also the option of hiring a "grand taxi" (shared public car) or taking one of the cheap but infrequent buses.
There are no direct flights from Marrakesh to Rabat; you’d have to stop through a European city on the way, making it a lengthy and inconvenient trip.
By Rental Car
Duration: 3.5 hours
Booking a private transfer is the most convenient way to get from Marrakesh to Rabat, and many travelers spend time in the city of Casablanca en route. While the city is mainly a transport and business hub, there are a few interesting sights to see, notably the Hassan II Mosque, the Casablanca Cathedral, and a café modeled after the famous Rick’s Cafe from the film "Casablanca." Casablanca boasts a sophisticated international dining scene, making it a great place to stop for lunch.
The drive up the Atlantic coast from Casablanca to Rabat is filled with beaches and coastal getaways worth exploring, including Mohammedia and Temara. See more about this part of the route here.
Renting a car is also possible, and a few major rental car companies, including Europcar, exist in Marrakesh. You should expect to pay cash tolls on the highway. Try to bring exact change—if you only have large bills, be sure to double-check the change that the toll officer gives you, as short-changing at toll booths is a common scam. Always follow the speed limit when driving in Morocco to avoid fines.
Duration: 4-5 hours
Trains run from Marrakesh to Rabat every few hours, from early morning until about 9 pm. Tickets can be purchased at the station, and schedules can be viewed on the official ONCF website.
While trains in Morocco are slow and sometimes run late, the ride is generally comfortable. You will have the choice to purchase either first-class or second-class tickets. Refreshments and toilets are usually available onboard the train (although it’s wise to bring your own snacks just to be safe, particularly during the month of Ramadan).
By Grand Taxi
Duration: 3-4 hours
In Morocco, a "grand taxi" is a private car that transports passengers for long-distance journeys. These cars are usually shared, so prepare to share your space with up to five other passengers unless you pay a higher fee to buy up all the seats in the car. The car will leave once all the seats are full or have been paid for.
The grand taxi station is located north of the medina in Marrakesh. Taking a grand taxi between Marrakesh and Rabat will be quite a bit more expensive than taking the train or bus. Be sure to ask about the price beforehand. It is useful to have small bills with you since some taxi drivers will claim not to have change.
Duration: 4-5 hours
The two main bus operators in Morocco are CTM and Supratours.
Supratours is run by the ONCF, Morocco’s official train operator, and is intended to supplement the train service. Since there is already a direct ONCF train line running from Marrakesh to Rabat, Supratours does not run on this route.
CTM does offer service between Marrakesh and Rabat. The price is similar to the train. Buses leave once every few hours in the morning and afternoon. Schedules can be viewed on the CTM website, and tickets can be purchased at CTM’s office in Marrakesh.