The Magic Staff was an item needed to open the door to the Desert Temple.
When Graham spied the desert bandits opening the door to the temple, the waved a staff and shouted a magical phrase. Graham liberated the staff from a snoring cutthroat's tent so he might enter the temple himself. Interestingly, the 40 thieves that Ali Baba had to deal with used the same magic incantation, "Open, Sesame!" In order to enter that particular lair, though, they weren't required to use a magic staff. When the staff was used by Graham, it shattered and its pieces were left on the steps of the temple.
Behind the scenesEdit
This is known as the 'Staff' in KQ5 Hintbook. An issue of Nintendo Power refers to it as the Shepherd's Staff.