Under the deal, which is subject to regulatory approval, EABL will dominate the beer market in Kenya and SABI in Tanzania.
SAB's ultra-modern 2.8bn shilling (£24.7m) Castle brewery in Thika, near the Kenyan capital Nairobi, and EABL's smaller operations in Moshi, Tanzania, will both be closed.
"Excess industry capacity in both countries means that both acquired plants are to be closed forthwith," EABL said in an advertisement in Tanzania's Guardian newspaper.
SAB's withdrawal from Kenya is seen by many as a victory for EABL's Kenya Breweries after a protracted "beer war".
The South African brewer started brewing in Kenya in 1998, sparking a marketing war with the Kenyan rival.
The two brewers will continue making some of each other's brands in Kenya and Tanzania under licence.
Little cheer for workers
EABL said the closure of its Tanzania plant would lead to redundancies, but staff would receive generous severance packages.
Four hundred Kenyans employed at the SAB brewery have been laid off and another 600 in the company's distribution chain will lose their jobs, according to the former corporate affairs director Joe Wanjau.
"The beer markets in Kenya and Tanzania have not grown at a rate adequate to justify the very large capital investment required to maintain the breweries," EABL said in a statement.
In Kenya the beer market has declined by 29% since 1996, with a similar fall in Tanzania, the statement said.
"No payment or consideration will be incurred between SAB and EABL," the statement added.
SAB will take a 20% stake in Kenya Breweries, EABL's wholly owned subsidiary, which in turn will take a 20% stake in Tanzania Breweries.