The stone got past the elephant's fence and a ditch separating the animal and visitors, the zoo said in a statement.
The girl was taken to hospital and died within a few hours, the zoo added.
The zoo statement said the enclosure met international standards and said "this kind of accident is rare, unpredictable and unusual".
Africa Live: More on this and other stories
The statement went on (in French) to point out two other recent incidents in the US:
Phyllis Lee, Scientific Director of the Amboseli Trust for Elephants, says that targeted throwing of stones and branches by elephants is very unusual.
"It can happen when elephants are frustrated or bored. In my opinion, it's unlikely the elephant was directly targeting the girl - but exhibiting frustration. You can't predict what animals in captivity will do."
The moments after the girl was struck at Rabat Zoo on Tuesday were filmed by a bystander and uploaded onto YouTube.
The video shows the elephant waving its trunk behind a fence and swerves round to show a stone on the ground.
Metres away people are gathered around the girl, holding her head and stroking her leg.

The one-year-old spaniel bitch was found on the A20 in Harrietsham, near Ashford, on Tuesday.
She had some "really nasty wounds" on her feet and legs which were "covered in pressure sores and urine scald", an RSPCA spokesman said.
The dog, which has now been named Flick, has already been offered a home.
She had no form of identification and was not microchipped, the RSPCA said.
Live: More on this story and other news from Kent
A spokesman for the charity said: "She has a docked tail and some really nasty wounds on her feet and her legs. Vets believe she has had her claws forcibly and traumatically removed, while her legs are covered in pressure sores and urine scald."
Under the Animal Welfare Act 2006, owners are only allowed to dock the tails of dogs who were certified working dogs under five days old, or for medical reasons as recommended by a vet.
"To forcibly remove a dog's claws is an abhorrent act and is illegal under animal welfare law in this country," the spokesman added.
"And to simply abandon her by the side of the road like rubbish when she is clearly injured and in need of veterinary treatment is unbelievably shocking."
A seven-year-old girl has died after being hit by a stone thrown by an elephant from its enclosure at Rabat Zoo in Morocco.
[NEXT_CONCEPT]
An injured dog has been found dumped in a bush with an illegally docked tail and having had her claws "forcibly" removed, the RSPCA says.