The cultural factor at play here is respect of women and perception of women. Morocco is an Islamic state, and women are expected to dress conservatively and women in Morocco often wear hijabs. American women are much less conservative in the way they dress and may be perceived as promiscuous by Moroccan men who are not used to the American style of dress. There is a lot more discrimination against women in Morocco and women are not as respected as they are in America, so it is not surprising that the student is being sexually harassed.
The student should talk to her host family about the issue but if she continues to feel unsafe, she should contact the Moroccan police or the US Embassy. Her host family can give the student advice on how to avoid people and situations that can be threatening.
To cope with the current situation, the student should walk home with friends and travel in groups. She should also learn which areas and streets to avoid. She may want to alter her style of dress to be more conservative in accordance to the cultural norm in Morocco.