During the appointment, the Duchess of Sussex presented the king with letters from Britain's Queen Elizabeth II, and they also met the king's sisters, Princess Lalla Hasna and Princess Lalla Meryem, as well as the Crown Prince of Morocco, Moulay Hassan. Here are some of the best pictures of them during the three-day trip.
Speaking with staff at the Moroccan NGO Education For All (EFA) boarding house in Asni, which provides education for girls aged 12 to 18 from rural communities, one teacher congratulated Meghan, 37, on her pregnancy. The centre provides classes for girls from rural areas whose families can not afford their education.
And just last week, Meghan made a surprise trip to New York City for a baby shower thrown by her pals Amal Clooney, Serena Williams and Jessica Mulroney. "You are such good role models". She used her speech at the event to spread a message of female empowerment, telling the audience: "Women have to challenge everywhere in the world".
The duke and duchess, whose baby is due in April, toured classrooms where most pupils were fluent only in French.
Lady Gaga wants award show categories to be gender-neutral
The feud in question began in 2011 when Madonna noted the similarities between her 1989 hit "Express Yourself" and Gaga's "Born This Way".
On their final day, the royal pair visited an equestrian centre to learn more about the country's efforts to use horses in therapy for children with special needs.
Have you been following Prince Harry and Meghan's tour of Morocco?
A Kensington Palace spokeswoman said: 'Their royal highnesses are very much looking forward to the visit and are grateful to their hosts and the British Embassy for arranging such an interesting programme.
On the other hand, one royal fan said that the Queen, as the monarch, would have a say on the matter because the children of royal couples belong to the royal family in a way especially if they are considered working royals.