Dortmund announced the deal with the 28-year-old Colombian the day after they were eliminated from the Champions League quarter-finals in a 3-2 aggregate defeat by Real Madrid.
There were no financial details available on the transfer but German media reported the deal to be worth about 10 million euros (£8.2 million)
Ramos has scored 32 goals in 89 Bundesliga appearances for Hertha, 16 of which have come this season.
"It was my wish to take the next step in my career and play in the Champions League," Ramos told the Hertha website.
"Everyone who knows me knows that I will give it all in the remaining games for Hertha."
Ramos, expected to feature at the World Cup in Brazil in June, joined Hertha from Colombian club America de Cali in 2009.
Poland international Lewandowski, 25, agreed earlier this year to join Bayern at the end of the season on a five-year contract.
- Sports & Recreation
- Adrian Ramos