Spring, from March to May, is the nicest time of year in Marrakesh; autumn, from September through November, is nearly as pleasant. If possible, plan your vacation during one of these months.
June through August brings suffocating summer heat, while November through March sees warm days, hovering in the mid-60s to low-70s, and chilly nights, dipping into the 40s and 50s.
Consider avoiding a visit during Ramadan, which is a month-long fasting period during the ninth month of the Islamic calendar (July and August in coming years), as many restaurants and other establishments are closed or have abbreviated hours.
The three days following Ramadan, however, are a great time to be in Marrakesh, as the city is enveloped in a huge celebration called Eid ul-Fitr, with feasts, gift-giving, and special religious ceremonies.