(Rev. 20:7-8 KJV) “7 And when the thousand years are expired, Satan shall be loosed out of his prison,
8 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.”
Satan will be released in order to test those that were born during the 1000 years of peace. A great number will be deceived and join Satan and come together to battle against God.
Gog and Magog here is not the same events that Ezekiel talks about in EZ. 38-39. What both events have in common is they rebel against God. God uses the same names to show they are both driven by Satan.