It happened in 1906.
Theodore Roosevelt was the first commander in chief to travel outside the U.S. on official business, when he sailed to Panama in November 1906. Roosevelt made the trip in order to inspect the construction of the Panama Canal, a project he’d championed. In 1943, in the midst of World War II, Roosevelt’s fifth cousin, Franklin, became the first sitting American president to fly on an airplane when he journeyed to Casablanca, Morocco, for a strategy meeting with British Prime Minister Winston Churchill. Franklin Roosevelt took to the skies in a commercial aircraft; the following year, for the first time ever, a plane was configured specifically for presidential use.
Other commanders in chief who were among the earliest to venture beyond America’s borders while in office include William Taft, who in 1909 made the first U.S. presidential visit to Mexico. In 1923, Warren Harding became the first to visit America’s neighbor to the north, Canada, stopping in Vancouver on his way back from the first-ever presidential trip to Alaska. As it happened, Harding died a week later, in San Francisco. Woodrow Wilson was the first sitting U.S. president to travel to Europe when he sailed to France in December 1918 for a World War I peace conference. Calvin Coolidge’s lone international trip was to Cuba in 1928 to attend a conference; he’s the only U.S. president to have visited the Caribbean nation.
In 1945, Franklin Roosevelt became the first American president to visit Russia when he attended the wartime Yalta Conference with Churchill and Soviet Premier Stalin. In 1959, Dwight Eisenhower became the first to make a trip to India, while in 1972 Richard Nixon was the first to visit China. Two years later, Gerald Ford was the first sitting U.S. president to travel to Japan. His successor, Jimmy Carter, was the first to make a state visit to Sub-Saharan Africa when he went to Nigeria in 1978. More recently, Barack Obama made the first-ever U.S. presidential visits to Cambodia and Myanmar, in 2012, and Kenya and Ethiopia, in 2015.