The official language in Morocco is Arabic. Moroccans speak an Arabic dialect with a strong accent, but most of them also speak Standard Arabic. Someone from Egypt would not understand someone speaking Moroccan Arabic. But both of them could communicate with each other using standard Arabic.
25 per cent of the population also speaks Berber dialects. And most of the populations knows a basic French. Spanish is also spoken North of the country, not in Marrakech.