The quick answer is, of course, that it wasn't filmed in one shot, but the final result is a film that appears to be. A lot of the time 'one shots' tend to be a bit overinddulgent. Rarely are such shots done in such a way that they serve a true storytelling purpose. But when they are done right, such shots can be stunning to watch, as well as driving the story forward.
1917 isn't the only feature film to have been made to appear as one continuous take. Famously 2002's The Russian Ark was truly filmed in one take using a Steadicam, and it was heralded as a technical triumph. 1917 is an entirely different animal. Set during the Great War, it required huge, complicated sets, pyrotechnics, scenes in white water (the river Tees near Barnard Castle and Tees Barrage if anyone is interested), all of which makes shooting such a production truly in one shot impossible.
But that didn't deter Roger Deakins. Pushing things to the limit, 1917 required meticulous rehearsal so that everything could be timed, in some cases, almost to the second, with rarely a window for error. In the video below Hurlbut Academy takes a close look at how the cinematography in the film was created.