The reference is to the girl. However, I do see why you might be confused.
I will re-word it for you.
"The girl fell off her bike. The girl hit her head on the road."
As for your question: "If it was "she", what would she do to hit her head?" the answer is simple, but not perhaps clear to a non-English speaker.
"She" did not do anything to "hit her head." Hitting her head was a consequence of falling from the bicycle. "She" did not deliberately pound her head on the ground. It is likely that when she fell her head hit the ground first.
Think of this example. He fell down the stairs. He broke his leg. Written another way, you could say: He broke his leg when he fell down the stairs.
The girl hit her head when she fell from her bicycle.
I hope this helps!
Good luck in your studies!