The Irish lock, 30, sustained a recurrence of an old groin injury in training earlier this week which proved to be more serious than the Lions medical team first thought.
The Lions had hoped O'Kelly would be available for selection in one of the early tour matches, but an Auckland-based specialist has confirmed the worst.
O'Kelly said: "I am obviously very disappointed that for me the tour is over. I have had this problem for a while but had managed to keep it at bay.
"I have to be philosophical and accept the judgement of the doctors. It is as well just to accept it and go home, and let the coaches and players get on with the job of trying to win the series against New Zealand.
"They are a great bunch and though I am sorry I will no longer be part of it, I wish them all the best."
The Lions were planning on announcing a replacement for O'Kelly within a few hours.
Head coach Sir Clive Woodward said: "Mal is a terrific player and it is always very sad when a top-class player loses out to injury like this.
"We spoke after he saw the specialist and agreed there was no chance of him being fit enough to play and it was better for the tour if a replacement was called out.
"It is very sad for Mal but his attitude has been first class. Even now, he has put the broader interests of the Lions first."
O'Kelly was ruled out of the Lions' 25-25 draw against Argentina after suffering an abdominal strain during preparations in Cardiff.
He returned to training this week but suffered what Lions doctor James Robson has described as a "lower abdominal oblique groin injury".
O'Kelly was immediately withdrawn from the bench for Saturday's tour opener against Bay of Plenty and replaced by Irish colleague Donncha O'Callaghan.
The injury had left Dr Robson baffled and, after phoning colleagues in Britain and Australia, he sent O'Kelly to see a specialist in Auckland.
"It is a peculiar injury for which I have actually been on the phone and consulted with colleagues back home and in Australia,' Robson said on Thursday morning, before O'Kelly had been seen by the specialist.
"I think we have unmasked something that might have been going on for a little while and might have contributed to the injury we were presented with a week ago."
Robson had remained hopeful the problem could be solved but he did admit O'Kelly's hopes of staying on tour hung in the balance.
"That is the same scenario every time someone knocks on my door. Every injury that occurs every day is potentially tour threatening because you are talking about highly tuned athletes and Malcolm is no different to that," Robson said.
"Players who pick up injuries are potentially off tour until proven otherwise."