What passages in the New Testament portray Egypt as a symbol of “slavery and sin”?
Actually, because of the exile of the Jews in Babylon, the New Testament uses Babylon more often as the symbolic place of sin, and even Rome (Revelation 17:7–18). Examples of Babylon used as a symbol of sin are Revelation 14:8, 16:19, 17:5, 18:2, 18:10 and 18:21. Revelation 17:5 will serve as an example of using Babylon as a metaphor for sin. “On her forehead a symbolic name was written: Babylon the Great, the mother of prostitutes and of the vile things of the earth. To the Jews, their captivity/slavery in Babylon was a more poignant memory, which will explain why God uses this metaphor more in the New Testament.
As for Egypt being used as a metaphor for sin/slavery, the first example that comes to mind is Matthew 2:15 in which Matthew points out that the prophecy in Hosea 11:1 is fulfilled in Christ. “Out of Egypt I called my son.” Here Matthew uses Israel in Egypt as a metaphor as Jesus goes into Egypt. Perhaps a more obvious reference to Egypt as a symbol for sin is in Revelation 11:8 which says of God’s enemies, “Their dead bodies will lie in the public square of the great city, which is called prophetically Sodom or Egypt, where also their Lord was crucified. Being in Egypt is used symbolically in Hebrews as well (Hebrews 3:16, 8:9, 11:26-27).
Let me add that the entire section from Hebrews 3:14-4:11 is one extended metaphor comparing Israel who left Egypt, which the Hebrew writer uses to symbolize the Christians who have also left Egypt. He notes that the Israelites bodies were scattered across the desert. They had left Egypt but they did not enter God’s rest. Metaphorically, he compares this to those of us who have been saved but who fall away and do not make it to heaven. He then compares the entering into the Promised Land as our entering into our rest. So, the entire section is using “Egypt” as representative of us before we were saved. Also, Paul does something similar in 1 Cor 10:1-13 in which he compares us to Israel who were baptized into Moses when they left Egypt. It does not actually say that being in Egypt is equivalent to being lost and in sin, but the metaphor is being used that way.