When I flew back to the states on a C-130, it made a stop in Reykjavik, Iceland. (cargo off-load/on-load, fuel, and crew change) We weren't allowed to get off the plane since we did not have passports/visas to be there. (Germany to RAF Upper Heyford to Iceland to Loring AFB in Maine to Glenview Naval Air Station near Chicago- 28 hours)
And yet, on trips to and from Russia, I've made stops and even changed planes in Stockholm and Copenhagen, and didn't have to clear customs (since I didn't have my luggage) or immigration (I never left the secure side of the airport). When I shipped out to Vietnam, the MAC flight made a refueling stop in Japan. We were allowed off the aircraft, but only to sit around on the tarmac until the bird was ready to take wing again.