The best time to visit Morocco is during mid-March to May or September to October. The weather is very pleasant. Winters are very cold and snowy. Summers are extremely hot.
Year-round, however, one can visit the coastal regions. In this part of Morocco, winter is pleasantly mild, while in the summer the temperatures hover around the high 70°Fs.
If cold weather does not bother you, the High Atlas Mountains can also be visited all year round. But note that it does get really cold in winter. The summer may still be a bit hot to go on any long-distance hikes, but if you tolerate the heat, you can embark on long hikes any time between April and October.