Botswana government spokesman Jeff Ramsay said the 74-year-old was on a private visit up north in the Okavango area when he had the accident. "He was hunting for elephant. He has a permit," the spokesman said.
The fall occurred early Friday in the chalet where the head of state was staying, said Angel Villamor, spokesman for San Jose hospital in Madrid where the king had his operation.
Juan Carlos flew back and was driven to straight to hospital after landing, a royal palace spokesman said. The palace also said the king had sustained "a fracture in three fragments of the right hip, associated with osteoarthritis of that joint."
Spanish state broadcaster RTVE carried the news on its website accompanied by a photograph of the king, rifle in hand, standing next to a dead elephant while on a previous hunting trip with a Botswana-based safari company.
The surgery was the king's fourth since May 2010. Previously, a benign tumor has been removed from one of his lungs, and in June last year he also underwent surgery on his right knee.
This is not the first time the aging monarch's love of hunting has caused concern. In October 2006, a Russian governor launched an inquiry into reports that Juan Carlos had shot and killed a bear while on holiday near Moscow.
Vyacheslav Pozgalyov, governor of the Vologda region northeast of Moscow, had reportedly received a letter from the region's deputy hunting chief, Sergei Starostin, claiming a bear -- named Mitrofan -- had been fed honey mixed with vodka before being released near a site where the king was to hunt.
The royal family has enjoyed hunting with firearms for decades, but has also experienced its share of gun-related tragedies.
The king's 13-year-old grandson, Felipe Juan Froilan, is currently recovering in a hospital after shooting himself in the foot accidentally with a shotgun.
The most serious shooting incident occurred in 1956 when Juan Carlos accidentally shot and killed his 14-year-old brother while handling a gun during a vacation visit to Estoril, Portugal.
More Nation & World Headlines
Four Confederate flags left at MLK center, church in Atlanta 7:48 a.m. Cincy police officer pleads not guilty in fatal shooting 7:47 a.m. Cop indicted for murder in traffic-stop shooting Will ‘Happy Birthday’ song be free to use soon? Debris linked to missing Malaysian 777 Export-Import Bank excluded from highway bill 777 departs Aleutians after emergency landing House approves highway funding bill
Our new comment system is not supported in IE 7. Please upgrade your browser here.