Gog and Magog are mentioned together in two Bible passages. The first is from Ezekiel:
Son of man, set your face toward Gog, of the land of Magog, the chief prince of Meshech and Tubal, and prophesy against him (Ezekiel 38:2)
Ezekiel 38 and 39 contain a prophecy about some nations that would attack Israel but be miraculously defeated by God. This has not yet been fulfilled. Gog is the “chief prince” and leader of the attacking armies, and Magog is the land he is from. Magog is usually identified with a region of Turkey south of the Black Sea, although the ancient Jewish historian Josephus (Jos Ant 1.6.1) identified Magog with the Scythians who lived north of the Black Sea. Some modern commentators have attempted to link Gog and Magog with Russia, although this is unlikely (see Will Russia invade Israel?).
The second Bible passage to mention Gog and Magog together is near the end of Revelation:
And when the thousand years are ended, Satan will be released from his prison and will come out to deceive the nations that are at the four corners of the earth, Gog and Magog, to gather them for battle; their number is like the sand of the sea. (Revelation 20:7-8)
Here, Gog and Magog appear to represent the combined group of nations that are hostile to Jesus Christ at the end of his 1000 year reign. It is common in Revelation for an Old Testament passage to be used as the basis of a prophecy or description of a vision. Here, the prophecy in Ezekiel is being used to foreshadow what will happen at the end of the 1000 year reign of Christ.