Dress respectfully if you do not wish to attract undue attention. This typically means covering your body between your knees and elbows e.g. trousers, long shorts or skirt to the knee (at least) and short-sleeved shirts or t-shirts.
In large cities such as Marrakech, Fes or Agadir, Moroccans dress as fashionably as they would on High Street in Europe although, in contrast, you will also see women traditionally dressed in derra (hood like scarf that covers all hair and is tied under chin) and jellaba (long-sleeved, ankle-length, flowing dress).
In rural areas women usually wear traditional clothes and you are encouraged to dress more conservatively when touring.
In summer, loose clothing is comfortable in the heat and when travelling i.e. April/May through October, although a jacket or cardigan is recommended for an unexpectedly chilly evening/night.
In spring and autumn, a warm fleece or jacket in recommended for chilly evenings i.e. March/April and November, although days are usually warm and sunny.
In winter, warm clothing is essential i.e. December through to April, when the weather is unpredictable especially at night in the desert and mountains.
October is traditionally the rainy season however these days the seasons are increasingly unpredictable and I have seen flooding in the desert in May.