The phrase apple of my eye refers to something or someone that one cherishes above all others.
Its meaning does indeed derive from an expression signifying the pupil of the eye, one of the most sensitive parts of the body. For example, one can tolerate an eyelash on the white of his eye, but let it barely touch the pupil, and everything else is of secondary importance.
The Bible references below (from the King James Version, translated in 1611) contain the English idiom "apple of my eye." However the Hebrew literally says, "little man of the eye." The Hebrew idiom also refers to the pupil, and has the same meaning, but does not parallel the English use of "apple."
The earliest appearance of the term is found in King Alfred's writing in the ninth century AD. Originally this term simply referred to the "aperture at the centre of the human eye" viz. the pupil.
Shakespeare also used it in the 1590s when he wrote A Midsummer Night's Dream:
"Flower of this purple dye, / Hit with Cupid's archery, / Sink in apple of his eye".
It also appears in the King James Bible Translation from 1611:
Deuteronomy 32:10
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.
in the Book of Psalms 17:8
Keep me as the apple of the eye, hide me under the shadow of thy wings
in Proverbs 7:2
Keep my commandments, and live; and my law as the apple of thine eye.
Lamentations 2: 18
Their heart cried unto the Lord, O wall of the daughter of Zion, let tears run down like a river day and night: give thyself no rest; let not the apple of thine eye cease.
as well as in Zechariah 2:8
For thus saith the LORD of hosts; After the glory hath he sent me unto the nations which spoiled you: for he that toucheth you toucheth the apple of his eye.
The original Hebrew for this idiom, in all but Zechariah 2:8, was 'iyshown 'ayin (×ישון עין), and can be literally translated as "Little Man of the Eye." This is a reference to the tiny reflection of yourself that you can see in other people's pupils. Other KJV translations of the word 'iyshown include dark and obscure, as a reference to the darkness of the pupil.
This Hebrew idiom is surprisingly close to the Latin version, pupilla, which means a little doll, and is a diminutive form of pupus, boy, or pupa, girl (the source also for our other sense of pupil to mean a schoolchild.) It was applied to the dark central portion of the eye within the iris because of the tiny image of oneself, like a puppet or marionette, that one can see when looking into another person's eye. In the Old Babylonian period (c. 1800-1600 BC) in ancient Mesopotamia, the expression "protective spirit of the eye" is attested, perhaps describing the same phenomenon.
...
Wikipedia