Jesus only calls those sheep whose names have been written down since before the foundation of the world. (Ephesians 1:4). Those sheep know His voice and listen to them. Those sheep follow Him out of the sheepfold and into green pastures. He doesn’t put a general call into the sheepfold and wait to see who will come out. He knows them by name, and He calls them.
Truly, truly, I say to you, he who does not enter the sheepfold by the door but climbs in by another way, that man is a thief and a robber. But he who enters by the door is the shepherd of the sheep. To him the gatekeeper opens. The sheep hear his voice, and he calls his own sheep by name and leads them out. When he has brought out all his own, he goes before them, and the sheep follow him, for they know his voice. (John 10:1-4)
John 10:1–2. Verses 1–5 describe a morning shepherding scene. A shepherd enters through a gate into a walled enclosure which has several flocks in one sheep pen. The enclosure, with stone walls, is guarded at night by a doorkeeper to prevent thieves and beasts of prey from entering. Anyone who would climb the wall would do it for no good purpose.
John 10:3–4. By contrast, the shepherd has a right to enter the sheep pen. The watchman opens the gate, and the shepherd comes in to call his own sheep by name (out from the other flocks). Shepherds knew their sheep well and gave them names. As sheep hear the sound of their owner’s familiar voice, they go to him. He leads them out of the pen till his flock is formed. Then he goes out toward the fields with the sheep following him.
John 10:5–6. If a stranger enters the pen, the sheep run away from him because his voice is not familiar. The point of this figure of speech consists in how a shepherd forms his flock. People come to God because He calls them (cf. vv. 16, 27; Rom. 8:28, 30). Their proper response to His call is to follow Him (cf. John 1:43; 8:12; 12:26; 21:19, 22). But this spiritual lesson was missed by those who heard Jesus, even though they certainly understood the local shepherd/sheep relationship. In their blindness, they could not see Jesus as the Lord who is the Shepherd (cf. Ps. 23).
John 10:7–9. Jesus then developed the shepherd/sheep figure of speech in another way. After a shepherd’s flock has been separated from the other sheep, he takes them to pasture. Near the pasture is an enclosure for the sheep. The shepherd takes his place in the doorway or entrance and functions as a door or gate. The sheep can go out to the pasture in front of the enclosure, or if afraid, they can retreat into the security of the enclosure. The spiritual meaning is that Jesus is the only Gate by which people can enter into God’s provision for them.
When Jesus said, All who ever came before Me were thieves and robbers, He referred to those leaders of the nation who cared not for the spiritual good of the people but only for themselves. Jesus the Shepherd provides security for His flock from enemies (whoever enters through Me will be saved, or “kept safe”). He also provides for their daily needs (the sheep come in and go out, and find pasture).
Source: Blum, E. A. (1985). John. In J. F. Walvoord & R. B. Zuck (Eds.), The Bible Knowledge Commentary: An Exposition of the Scriptures (Vol. 2, pp. 309–310). Wheaton, IL: Victor Books.