It's hot and sunny for most of the year in Morocco. During the peak summer months it gets uncomfortably hot especially in Marrakech, Fes and southwest Morocco, towards the desert. Casablanca, Rabat and Essaouira are a bit more comfortable in the peak of summer because they benefit from a cooler ocean breeze. Winters (November to February) are generally mild although temperatures at night can get down to the 40's Fahrenheit (10 C).
A dusting of snow is not unusual in Northern Morocco and of course the Atlas Mountains get a lot of snow. You can even ski in Oukaimeden just outside of Marrakech. Winters in the north of the country and along the coast can be quite wet. Winters in the south are drier but colder, especially at night.
Scroll down to see what temperatures you can expect in Rabat (which are basically the same as in Casablanca) and Marrakech. There's more climate information for those planning trips to the Sahara Desert and the Atlas Mountains at the bottom of the page.
Rabat is not only hot during the summer but also humid. This can make it quite uncomfortable from July through September. Light, loose cotton clothing is highly recommended as well as copious amounts of sunscreen and bottled water.
Marrakech is hot during the summer and cool in the winter. If you do plan to visit in the summer, take a break from the heat and travel to the nearby Atlas Mountains or to Essaouira along the coast. The best time to visit Marrakech is in the spring and autumn with abundant sunshine during the day and cooler nights to enjoy those roof top restaurants overlooking the Djemma el-Fna.
The Atlas Mountains
The weather is unpredictable in the Atlas Mountains and obviously it depends on what elevation you're planning to get to. The High Atlas Mountains have a typical mountain climate with very cold winters (November to March) and cool but sunny summers. The Middle Atlas Mountains get a lot of rainfall, especially from November to February. Summer temperatures average around 72-78 Fahrenheit (25 C) and winter temperatures can get as low as -4 Fahrenheit (-20 C).
If you're planning a trip to the Sahara Desert it's best to hop on a camel during the fall or early spring. Temperatures average around 115 Fahrenheit (45 C) during the summer and it's obviously dry as a bone. Nights in the desert do get much colder however and you'll need a good jacket even if you're sweltering during the day. During March and April you have a good chance of dealing with sandstorms as the Sirocco whips up.
The Atlantic Coast
If you look at the temperatures for Rabat at the top of the page, this is basically what you can expect at Morocco's beaches. The weather is perfect in the summer, cooler than the interior and warm enough to heat up the ocean to make swimming quite pleasant.