The onlooker also videoed the huge stone that caused the unnamed girl's death.
Local reports said the girl's dad had lifted her up on his shoulders outside the elephant enclosure so her mum could take a snap of the two of them with their back to the animals when she was struck.
A spokesman for the zoo offered his condolences to the girl's grieving family, but appeared to deny her death was the zoo's responsibility.
He added that there had been no security breaches, and that she had not crossed into a protective area outside the enclosure.
Accidents of this type are rare, unforeseeable and unusual," he said in a statement, reports Morocco World News.
"Accidents of this nature have happened in international zoos, most recently in Disney World Orlando and the Cincinnati Zoo in the United States."
Social media users said the ambulance took ages to arrive and said the zoo should have its own ambulance station.
One said: "How is it possible that the place receives a large number of visitors but there is no ambulance station."
The tragedy, which happened around 1pm local time on Tuesday, was the first of its kind since the zoo opened in 2012.
One fan who visited soon after it opened said on TripAdvisor: "You forget what country you are in when you arrive at the new zoo in Rabat, Morocco.
"It is a world-class zoo and family friendly. You can easily navigate a baby stroller throughout the zoo.
"What is impressive is the large space and open feel."
Another added: "We loved the zoo, especially the children but there was a lack of staff."