Swanhunter summed it up pretty well although I would say Meknes is a very distant third behind Fez and Marrakech for souks / historical towns (in that order, it may have changed since I visited but Fez is one of my favorite places I’ve ever been, whereas Marrakech was a bit underwhelming). If you’re interested in Roman ruins Volubilis could be a good day trip from Fez or Meknes. I’d also say you could spend a couple of days in Rabat, it had a different feel than the other major cities and I thought it was pretty interesting.
One thing to note though is that all of these suggestions are in different directions so if you go by train you may do some backtracking. Marrakech is to the south along with the coastal towns, whereas Rabat would be on the way to either Tangier (north-ish) or Fez and Meknes (east).