Germany international ter Stegen has long been linked with a move to Barcelona but his departure at season end had not yet been confirmed.
"After Marc-Andre ter Stegen told us that he will definitely leave at the end of the season we have agreed on the transfer details with his new club," said Gladbach sports director Max Eberl without naming where the keeper will transfer to.
"He will play abroad and that is now set. His successor in goal at Borussia will be Yann Sommer, an outstanding keeper who at 25 already has a lot of international experience."
Sommer signed a deal to June 2019.
Gladbach are battling for a European spot for next season, lying in eighth place in the Bundesliga with 10 games left in the season.
- Sports & Recreation
- Marc-Andre ter Stegen