In the first part of chapter 10 of John’s gospel, you find two different parables told by Jesus: one beginning at v. 1, and another at v. 7. Although, at first glance, they appear to be alike in content with the image of a shepherd and his flock, some clear differences are, in fact, observed.
"I tell you the truth, the man who does not enter the sheep pen by the gate, but climbs in by some other way, is a thief and a robber. The man who enters by the gate is the shepherd of his sheep (John 10:1-2).
This is the beginning of the first parable. If you are to interpret it allegorically, the “thief and robber” would be Satan, and the “shepherd” would be Christ. Keep in mind that the “sheep pen” has a “gate,” and many sheep are inside the pen. Note that the shepherd “enters” by the “gate.”
The watchman opens the gate for him, and the sheep listen to his voice. He calls his own sheep by name and leads them out. When he has brought out all his own, he goes on ahead of them, and his sheep follow him because they know his voice (vv. 3-4).
What makes this parable somewhat special and different from the common scene of shepherds in Palestine is that the shepherd does not open the gate by himself, but the “watchman” opens it for him. Once the shepherd enters, he “leads them (the sheep) out” through the gate by calling them by name. And once they are outside the pen, he “goes on ahead of them” and they “follow him.” What does this parable mean?
But they will never follow a stranger; in fact, they will run away from him because they do not recognize a stranger's voice (v. 5)."
Pay attention to the kind of relationship that the shepherd and the sheep have: they follow the shepherd because they know his voice, but run away from a stranger because they do not know his voice. These sheep belong to the Shepherd, and it illustrates well those who are in Christ.
From the context of chapter 9 and the subsequent stories in chapter 10, it is most likely that the day in which Jesus told these parables was Sunday, which was two days before Hanukah (The Feast of Dedication). Many Jews must have been already in Jerusalem to celebrate this feast. It was their custom that on Sundays, worshipers at the temple recited Ps 24 right after the morning sacrifice was given (on each day of the week, a certain psalm was recited).
Lift up your heads, O you gates;
Be lifted up, you ancient doors,
That the King of glory may come in.
Who is this King of glory?
The Lord strong and mighty,
The Lord mighty in battle.
Lift up your heads, O you gates;
Lift them up, you ancient doors,
That the King of glory may come in.
Who is he, this King of glory?
The Lord Almighty—he is the King of glory.
Selah (Ps 24:7-10)
These gates lift their heads toward heaven, and the King of glory comes in through them. With this psalm in the background, Jesus told the above parable. It depicts how the sheep, those who belong to him, will come alive and be led out of the sheep pen, in which they have been imprisoned by the thief. Jerusalem was surrounded by walls, and Jesus saw the people in it as the lost sheep without a shepherd in the sheep pen. Through his death and resurrection, he would lead them out—from the dominion of Satan to the care of the Shepherd and Overseer, from the bondage of death and fear to the pasture of life and freedom.
For he has rescued us from the dominion of darkness and brought us into the kingdom of the Son he loves, in whom we have redemption, the forgiveness of sins (Col 1:13-14).
This is what “in Christ” means. The depiction of the parable somewhat resembles the story of the valley of dry bones in Ezek 37. The dry bones of those who had been killed at the time of the destruction of Jerusalem came to life, forming a vast army, and were led out of the graves. Looking into more stories or passages that support the same truth always helps us understand the truth better by bringing more light to it.