Lehmann, who was part of Arsenal's 2003-04 "Invincibles" team, had been acting as a member of Hertha Berlin's supervisory board on behalf of investor group Tennor after the hasty departure of head coach Jurgen Klinsmann in February 2020.
Aogo, who is a pundit with Sky Germany and had covered the Champions League match between Manchester City and Paris Saint-Germain on Tuesday, posted a picture of the message he received from Lehmann after the game which said: "Is Dennis actually your Quotenschwarzer [token Black person]?"
Lehmann admitted the message came from his phone in a brief statement to Bild.
He also issued a statement on Twitter apologising to Aogo and complimenting him "as a former international who has a lot of expertise, a great aura and helps Sky to strong ratings."
Tennor released a statement after the incident that said Lehmann's contract would be terminated immediately.
"Jens Lehmann's contract will be terminated with immediate effect. This also means that his mandate on the supervisory board will no longer apply," a spokesperson for the investor group told Die Welt.
"We personally regret this, but it is not compatible with the principles of Tennor and [investor] Lars Windhorst. Especially against the background that we have many people of colour as employees."
Hertha Berlin president Werner Gegenbauer said the club welcomed the step taken by the investor group and added that "such statements in no way correspond to the values that Hertha Berlin stands for and actively advocates. Hertha BSC distances itself from any form of racism."
Just under a month ago, Hertha Berlin sacked goalkeeper coach Zsolt Petry with immediate effect after racist and anti-gay remarks in an interview in his native Hungary.