As far as the climate goes, the best time to visit the south of Morocco or at least the desert routes outside midsummer, when for most of the day it’s far too hot for casual exploration, especially if you’re dependent on public transportation.
July and August are the hottest months and can be wonderful on the coast, however, while in the mountains there are no set rules.
Spring comes late by European standards (around April and May), it represent perhaps the best overall time, with a summer climate in the south and in the mountains, as well as on the Mediterranean and Atlantic coasts.
Winter can be perfect by day in the south, though desert nights can get very cold.
If you’re planning to hike in the mountains, it’s best to keep to the months from April to October unless you have some experience of snow conditions.
The Islamic religious calendar and its related festivals will have the most seasonal effect on your travel.
The most important factor is Ramadan, the month of daytime fasting; this can be a problem for transport, and especially hiking.