The most well-known explanation for the development of this phrase dates back to the Battle of Copenhagen which was fought in 1801 between the navies of Britain and Denmark/ Norway. The British fleet was commanded by Admiral Sir Hyde Parker while Amiral Horatio Lord Nelson was his second in command. The two men disagreed on battle strategy and during the action, Parker signaled with flags that Nelson should disengage and retreat. Nelson was sure though, that if they remained in the fray, they would win the battle. He decided to ignore the order; according to his biographer Robert Southey, he said to the captain of the ship he was on and said, "Leave off action? Now damn me if I do! You know, Foley," turning to the captain, "I have only one eye- I have a right to be blind sometimes," And then, putting the glass to his blind eye, in that mood of mind which sports with bitterness, he exclaimed, "I really do not see the signal!" (The Life of Horatio Lord Nelson, 1813)
Nelson did not withdraw and his actions in the battle carried the day, securing a win for the British. When news of Parker's poor judgement reached London, he was relieved of his command which was then given to Nelson. As it turns out, though, while he popularized the expression "turn a blind eye," Nelson did not originate it.
"Gracious! you don’t say so? Why, he’s the very man for whom she had, her whole life, declared the greatest aversion."
"Why," replied Sir Harry, "the world is ill-natured enough to say, that as her ladyship and the general were engaged in a rubber, about three weeks ago, at the Viscountess of Loo’s, the general’s glass eye, by accident, fell upon the table -"
"Glass eye!" interrupted Lady Varny."
"I only speak from report," returned he; "yes, a glass eye; and that her ladyship, who has an excellent taste for nic-nacories, was so charmed by its structure, that she immediately resolved on giving him her hand, for which he had long been a private suitor."
"It is lucky for the poor man he has a blind eye to turn to her," cried Lady Varny [...]
"To be Crucify'd to the World, and to have the World Crucify'd to us; to be dead to its Pleasures, and insensible of its Charms, to turn the deaf Ear and the blind Eye to all those Pomps and Vanities of the World which we renounc'd at our Baptism; and to have it no longer in our Hearts, but under our Feet."
This seems to be the earliest written use of a form of this expression, though of course it's impossible to say if it was used verbally before this, or in written works long since lost.