Originally - Inspiration from Dune
It can be argued that George Lucas took a fair bit of inspiration from Frank Herbert's Dune series.
During the filming of David Lynch's Dune Frank Herbert noted the following
"David [Lynch] had trouble with the fact that Star Wars used up so much of Dune. We found sixteen points of identity between my novel and Star Wars. That is not to say this was other than coincidence, even though we figured the odds against coincidence and produced a number larger than the number of stars in the universe."
Frank Herbert doesn't go on to list those 16 similarities, however there are many that are quite easy to spot ourselves
- Tatooine a desert planet / Arrakis (Dune) a desert planet
- Both have sand crawlers
- Both mention spice
- Swords/knives/lightsabers are still important weapons despite the sci-fi setting
- Jabba the Hutt / God Emperor Leto II
- Fremen / Sand people
- Sarlacc / Sandworm
- Mystical Powers - The Force / The Voice
The two desert planets are the most obvious similarities between the two.
Various other people have mentioned the similarities between Dune and Star Wars:
"I guess I would think that George Lucas would acknowledge Herbert's contribution to the epic quality of the genre. And while Star Wars has had more commercial success and more broad-based exposure than Dune, I believe anyone who would study both Star Wars and Dune would have to acknowledge the small debt that Star Wars owes to Dune."
John Harrison, director of Frank Herbert's Dune
"Of course, complicating the question, can there be any doubt that the FIRST movie version of DUNE was actually STAR WARS?..."These are not the droids you want" He uses The Voice on them! And there's a sandworm skeleton in the background! To say nothing of "The Sand People.""
Gardner Dozois, editor of Asimov's science fiction
"It really was, because Lucas realized you couldn't really make a movie of Dune"
Rick Austin, Vice-President of on-air for the Sci-Fi Channel
"Star Wars was heavily influenced by Dune."
Kevin J. Anderson, author of both Dune and Star Wars novels
There were also rumors, that I'm still trying to substantiate, that the original script for A New Hope was rejected for being too much like Dune. So, if this was the case, the similarities that are present were those that were kept or scaled back.
Once Tatooine was used in A New Hope it will then be revisited due to it being the home of our hero and as a familiar place tying the prequels in to the originals.
Subsequent directors on the new films use desert planets to give this familiarity without totally revisiting the same places.
The story of history repeating itself was, I believe, an obvious and intentional thing, and the structure of meeting a character who comes from a nowhere desert and discovers that she has a power within her, where the bad guys have a weapon that is destructive but that ends up being destroyed
J.J Abrams - Director of The Force Awakens
Though Gareth Edwards seems to have set Jedha on a desert planet as he was trying to evoke a Jerusalem or Mecca feel about the location.
"If A New Hope is kind of like the story of Jesus, there must be a whole religion beyond that," he said. "We felt like, for 1,000 generations, the Jedi were kind of these leaders of the spiritual belief system. It's got to be like a Mecca or a Jerusalem, but in the Star Wars world.
Gareth Edwards - Director of Rogue One
Jakku = Tatooine plus a spaceship graveyard