Larsson was given permission by Sunderland manager Martin O'Neill to have the surgery immediately to allow him recovery time for June's tournament where Sweden will face England, France and co-hosts Ukraine in the group phase.
"I have had problems with groin pain for a couple of weeks now," Larsson told Sunderland's website.
"I am extremely grateful to the club supporting me and giving me the opportunity to have the operation immediately.
"This means the conditions to be prepared for Euro 2012 are much better than if I had to wait until the end of the season."
Kieran Richardson is also ruled out for the last three games of midtable Sunderland's season, also with a hernia.
It will mean he misses the final game of the season at home to his former club Manchester United, who may well need to beat Sunderland to retain the title.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.