Thomas was among the injured on Stage 9 after Wilco Kelderman (Sunweb) hit a stopped police motorcycle causing a mass crash which sent several riders to the ground at the foot of the final ascent.
He bounced back on Stage 10 to record a brilliant second place in the individual time trial but struggled during the next two stages.
"I've been suffering since my crash on Sunday," Thomas said in a statement. "I've had an issue with my shoulder which is manageable, but my knee has also been getting worse each day.
"Obviously it's never nice to leave a race early, especially when it's your main goal of the season, but I have to look at the bigger picture."
Thomas said he would now spend some time recovering before preparing for the 1-23 July Tour de France.
“I’ll turn my attention to the Tour now, and I want to arrive there with as good form as I started the Giro.
His exit continues Team Sky's often mixed adventures at the Giro, a race where they have yet to enjoy the kind of winning success experienced at the Tour.
Sky's best-placed rider is now Philip Deignan, who is over 42minutes behind race leader Tom Dumoulin (Sunweb), and in 49th place overall.
Despite the setback, team boss David Brailsford said that there was still “plenty to fight for”.
“As far as the team goes, the GC has gone but there is the opportunity for our riders to achieve a stage win in the 100th Giro," he said.