The Battle of Gog and Magog happens twice in the Bible. Its first occurrence is in the Tribulation and ends at Armageddon when Russia and its armies invade Israel according to Ezekiel 38 and Ezekiel 39.
Its second occurrence is after the Millennium when Satan is loosed and deceives the nations to cause them to come against Christ and His Bride and the city of Jerusalem according to Revelation 20: 7 – 9: And when the thousand years are expired, Satan shall be loosed out of his prison, And shall go out to deceive the nations which are in the four quarters of the earth, Gog and Magog, to gather them together to battle: the number of whom is as the sand of the sea. And they went up on the breadth of the earth, and compassed the camp of the saints about, and the beloved city: and fire came down from God out of heaven, and devoured them.
The two invasions are thus separated by a thousand years. The battle prophesied by Ezekiel is preceded by the restoration of Israel (Ezekiel 37) and is followed by a description of the Millennium (Ezekiel 40 to Ezekiel 48), whereas the battle prophesied in Revelation is preceded by the Millennium and is followed by a description of the new heaven and the new earth (Revelation 21 and Revelation 22).