Spielberg had been refused permission to shoot the finale of 1989's Indiana Jones and the Last Crusade, the last part of the original trilogy, at the Petra archaeological site in Jordan.
However, after meeting Spielberg at a shooting event at Gleneagles, Stewart made an introduction to King Hussein of Jordan, who was also present.
The director was duly granted permission to use the location, and filming took place in August 1988.
The Al-Khazneh temple, also known as the Treasury, served as the temple housing the Holy Grail that Indiana Jones was seeking.
The cast and crew, including Sean Connery and Harrison Ford, were welcomed as guests of the Jordanian royal family.
Stewart recalled the story in an online call with his longtime friend HRH The Princess Royal as part of a series of videos he is making for his Racing for Dementia charity.
During the discussion, Stewart recalled his Gleneagles shooting events, which raised considerable sums for charity.
"I've got a list here somewhere of the people who were there, at one the last ones," he said. "Of course, we had your good self there.
"We had half of the royal family actually, because there was a royal team. And then there was a team of sportsmen, and then there was rich and bossy, that was another team! And they were all sponsored.
"I'm looking at this now. Harrison Ford, Steven Spielberg, Barry Gibb, Sean Connery, Rod Laver, Wayne Gretzky, Willie Carson, Kiri te Kanawa.
"When Steven Spielberg came along, he was surrounded by security, because he's American.
"And, of course, with everybody else, and there was a lot of royal family people there, nobody recognised they had security, it was very discreet, but they were there.
"I went to speak to him, and I'm saying how pleased I am that he's coming to the event. And he starts looking over my shoulder, and I'm thinking, what have I done to deserve this?
"And suddenly he says, 'Excuse me, but that looks like King Hussein of Jordan over there?'. And I said, 'Yes, that's who it is.'
"He said they'd been trying to get permission to go to Petra to do this film that he was doing with Sean and Harrison Ford, but they couldn't get permission.
"And I said, 'Maybe you should speak to his majesty?' So I got them together. Bingo. He got his permission, so he was a very happy chappy."
Stewart also outlined the role of Racing for Dementia, which he was inspired to found after his wife Lady Helen developed the disease.
The organisation aims to use the speed of development seen in racing to help find treatments.
"For Helen, it's a tough time as you're aware," he said. "She's got dementia. One in three people in the world now will die of dementia, and more people die of dementia than any other illness.
"We are using sport for young PhDs, because in sport, you're desperate to win. And nobody remembers who's second.
"And in motorsport, the speed of change is faster than almost anything I know. So we're using that for these young people, these new PhDs that we've got."