He has made nine appearances for the Reds during this campaign, including the Carling Cup victory against Tottenham, when Foster performed brilliantly in the penalty shoot-out.
"Ben has tried to continue the season with this injury but it got so critical that an operation was the only way forward," Ferguson added.
"It is disappointing for him but the important thing was to get this operation done."
It means Foster will be unavailable for the Champions League final against Barcelona in Rome on 27 May, as well as England's World Cup qualifiers with Kazakhstan and Andorra on 6 and 10 June respectively.
Foster joined the club in July 2005 but was loaned out to Watford, where he spent two seasons in the first team before coming back to United last summer.
Foster has battled Edwin van der Sar and Tomasz Kuszczak for the keeper's jersey at Old Trafford throughout the season.
He said in March he had no plans to quit United, despite admitting not moving could compromise his international prospects.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.