Matthew 25:1-13
But he answered, ‘Truly, I say to you, I do not know you.’ (Matthew 25:12 ESV)
I don't always answer my phone when it rings. To be honest I just don't really like talking on the phone that much. But most of the time when I don't answer the phone, its because I don't know who is calling.
Jesus' parable of the ten virgins illuminates a similar point. God will turn away those He does not know. That might sound contradictory if you think of it in terms of factual knowledge. I mean, God is supposed to be all-knowing right? But that kind of knowledge isn't what Jesus was talking about.
Centuries ago, especially in the Jewish culture, to know meant more than retaining information. It meant to experience something first hand. Thus, knowing God would mean that you had experienced Him. Experiencing God only happens through His Son, Jesus Christ.