Wales' record try scorer, who touched down twice in the Lions' third Test win over the Springboks this summer, had a routine procedure on his shoulder last week.
But Ospreys physio, Chris Towers, claims the timing of the operation was set to ensure Williams will be fit to return better than ever for the new season. Williams will return to training on 10 August, along with the Ospreys' other Lions.
"Shane underwent surgery to his shoulder on Tuesday, 14 July. It was a routine procedure that had been pre-planned to coincide with his return from the Lions tour," said Towers. "By the time Shane reports for pre-season training in August, he will already be four weeks post op and, apart from initially not being able to take contact and lift heavy upper body weights, there will be little impact on his pre-season preparations.
"A further four to six weeks should see him back to full training and available for selection, along with his Lions team-mates as per schedule."
The Ospreys reached the quarter-finals of the Heineken Cup for the first-time last season before having their title hopes blown apart by Munster at Thomond Park. They find themselves in the same Pool as last season's runners-up, Leicester Tigers, for the third time in five seasons.
They will meet the English champions at the new Welford Road on Sunday, 11 October. Ity is a match that will give the two Lions scrum halves, Mike Phillips and Harry Ellis, the chance to battle against each other, while Welsh skipper Ryan Jones will be joined in the Ospreys' back row by new recruit Jerry Collins.
One of their first tasks will be to quell Lions sensation Tom Croft, who marked his test debut in South Africa with two tries in Durban.