Jesus said that the gates of hell shall not prevail against it.
And I tell you, you are Peter, and on this rock I will build my church, and the gates of hell shall not prevail against it. (Matt 16:18, ESV)
Where does the gates of hell come from?
I've elsewhere explained in detail why Hades is translated as 'hell' in this passage, which is important for understanding it. However, in the interest of not reproducing an entire answer, I will only repost the relevant portion here.
The distinction between the Greek terms γέεννα (Gehenna), ταρταρόω (Tartaroo/us), and ᾅδης (Hades) was somehow lost in translation into the Latin Bibles and later into English Bibles. The early Hellenic, Jewish, and Christian understandings of ᾅδης are thoroughly explained in my other answer. It is my recommendation that ᾅδης be transliterated ('Hades') rather than translated (as 'hell'). With that said, this is not intended as a reference to eternal punishment in this passage, but rather as a metonymy for 'the power of death.'1
The IVP New Testament Commentary further supports this idea that ᾅδης is a metonymy for 'the power of death':
The “gates of Hades” in the Old Testament (Job 38:17; Ps 9:13) and subsequent Jewish tradition referred to the realm and power of death; death itself would not silence the church. Against those who presuppose that Jesus could not have planned the church, though he chose twelve disciples as the nucleus of a remnant for Israel (compare the symbolic use of twelve in the Dead Sea Scrolls), the language of a “church” was already being used for a remnant community among his contemporaries (Dead Sea Scrolls...).2
The translation would thus read,
And I tell you that you are Peter, and on this rock I will build my church, and the power of death will not prevail against it.
This is a good dynamic-equivalent translation, but a formal-equivalent translation may be desirable (this is a subjective preference). For this reason, it may be preferable to translate it like so:
And I tell you that you are Peter, and on this rock I will build my ekklēsia, and the gates of Hades will not overpower it.
Jesus was essentially saying, "Nothing can stop us! Not even death!"
1 cf. Biblical Studies Press, The NET Bible First Edition; Bible. English. NET Bible.; The NET Bible (Biblical Studies Press, 2006), Mt 16:18.
1 Craig S. Keener, The IVP Bible Background Commentary: New Testament (Downers Grove, IL: InterVarsity Press, 1993), Mt 16:18.
What did Jesus mean by 'the gates of hell'?
Interestingly enough the following online source sheds light on a place near Caesarea called exactly that, and Jesus was at this place, when he spoke about it, recorded in Mathew 16:18.
Further in this regard;
Paneas the worship of Pan in Gospel Times "The name refers first to the large cave from which one of the major sources of the Jordan river flows and, by extension, the cult center dedicated to the god Pan that had developed around the cave, at Caesarea Phillippi." This is where Jesus was with the disciples when He spoke Mathew 16:18 to Peter.
Panea the Worship of Pan "most pagan place in all of Palestine. Most devout Jews would probably avoid it altogether, but Jesus went there deliberately. In a rocky part of the city on a bluff were two temples. One was built to honor Caesar. (Caesarea) That alone would be considered blasphemy to the Jews, but nearby there was another temple built to worship the Greek god Pan. In fact, it was the worldwide center for Pan worship. As part of their devotion the followers of Pan would perform acts so lewd that I cannot mention them in this article. Right next to Pan’s temple was a great crevice or crack in the ground. It was thought to be the place where the dead spirits would go to and from Hades. It was called “The Gates of Hell.” "
Jesus was using a colloquial terminology understood by those in his day. In Biblical times, including the time that Jesus walked on the earth, the gates of cities were places where prominent men, including lawyers and judges sometimes sat, and even conducted business. (Look up Biblical cities, antiquity-)
These city gates were open during the day to allow people to enter and leave, especially open to merchants and farmers bringing their goods into the cities to sell. At night the gates were closed, for the protection of the people against enemies.
In Genesis 22 ESV we see a promise being given to Abraham by God that included:
"17 That in blessing I will bless thee, and in multiplying I will multiply thy seed as the stars of the heaven, and as the sand which is upon the sea shore; and thy seed shall possess the gate of his enemies;"
Possessing the 'gates of your enemies' means taking over your enemies' 'city, or whatever he has', which means triumphing over that enemy.
Case in point, Samson's removal of the gates of a city of the Philistines and using the actual gates to win against them with, under the anointing of God using superhuman strength. Samson took away their protection by removing the gates, thereby leaving them open to attack.
Judges 16 (KJV) 16 Then went Samson to Gaza, and saw there an harlot, and went in unto her. And it was told the Gazites, saying, Samson is come hither. And they compassed him in, and laid wait for him all night in the gate of the city, and were quiet all the night, saying, In the morning, when it is day, we shall kill him. 3 And Samson lay till midnight, and arose at midnight, and took the doors of the gate of the city, and the two posts, and went away with them, bar and all, and put them upon his shoulders, and carried them up to the top of an hill that is before Hebron.
'Gates' can mean the power, force and protection of something.
'The gates of hell' not prevailing against the church, means that the strategies and forces of darkness, Satan, the fallen ones, and all the enemies of Christ and His followers cannot triumph against the Church of Jesus Christ.
Interesting to note here, is that there is a juxtaposition happening, which must mean something as well. When Jesus is speaking about the 'gates of hell' He is on this, our side, looking toward them, and telling us the gates will not succeed against us. Normally, it would be us, on this side of the gates as an enemy army, advancing against the gates to beat our enemies.
My first impression is that Jesus is saying the gates won't advance against and win over us. My second impression notes that what Jesus seems to be saying is that He and we are on this side looking at the gates of hell, and that He wants us to attack them and overcome them, and as we do, they cannot hold up against us.
This interpretation is in keeping with What God told Abraham about his seed, "that they would possess the gates of their enemies.", Abraham's seed interpreted by the apostle Paul to mean Jesus, and then the Church, relating to Jesus' words about the gates of hell not being able to stand against the Church.! Why! Because the church is Abraham's seed, and God promised Abraham's seed they would 'posess the gates of their enemies', and hell is surely an enemy to the Church!, therefore the Church appears to be encouraged by Jesus to rush the gates of hell and win against their enemy, just as Jesus triumphed over it Himself.
The use of the 'gates of hell' here means the seat of power of hell itself, portrayed by the use of the word 'gates'. Jesus used the colloquial understanding of his day and time by the use of the word 'gates'.
An additional point would need to be addressed in the case where the words 'gates of hell' has been translated, 'gates of hades'. In this case a reference to physical death is included in the interpretation, so therefore Jesus' words may have included the meaning that 'the gates of hades' meaning the 'power of physical death' will not prevail against the Church of Jesus, even though generations of the 'called out ones' will succumb to physical death for a time, because of the resurrection even physical death will not win against the Church.