"He found him in a desert land, and in the waste howling wilderness; he led him about, he instructed him, he kept him as the apple of his eye."
Here, the phrase "apple of his eye" refers to something precious and protected. The idea is that the pupil of the eye is extremely delicate and sensitive, and it's something we instinctively shield.
Over time, the phrase evolved to mean someone or something that is dearly loved and cherished. It's a metaphor for the importance and value we place on something or someone special to us.
While the exact origin of the phrase is debated, the biblical connection is widely accepted as a major influence.