Lewandowski has won the past two Best Fifa men's player of the year awards
The 33-year-old, who has one year left on his Bayern contract, told the German champions last month that he wishes to leave.
Lewandowski scored 50 goals in 46 games last season as he helped Bayern win a 10th straight Bundesliga title.
Barca say the deal is "dependent on the player passing a medical and contracts being signed".
"It's good to have clarity for all parties," said Bayern president Herbert Hainer, who first announced the agreement on Saturday.
"We have come to a verbal agreement with Barcelona.
"Robert is an incredible player and he won everything with us. We are incredibly grateful to him."
Lewandowski joined Bayern on a free transfer from Borussia Dortmund in 2014 and has scored 344 times in 374 games for the club, making him their second-highest scorer of all time behind Gerd Muller.
The Pole has won the league in all eight of his seasons at Bayern and also helped the Bavarians win the Champions League in 2019-20.
"I would like to thank my teammates, staff members, club management and everyone who has always supported me and made it possible for us to win trophies for Bayern," Lewandowski said in a statement on social media.
"I am proud of what we have achieved together. Above all, I would like to thank the fans because it is you who make Bayern the special club that it is. I'm privileged to have spent eight wonderful years with this club and its fans and it will remain in my heart forever."
Bayern have also announced that Germany winger Serge Gnabry, 27, has signed a contract extension until 2026.
Barcelona completed the signing of Raphinha from Leeds on Friday in a deal worth up to £55m having already signed Franck Kessie and Andreas Christensen on free transfers earlier this month.
-- Courtesy of BBC Sport