Several colonial powers had ambitious North-South or East-West projects in Africa but none of them were fully realized, among other reasons because of rivalries between these powers (see Cape to Cairo Railway and related articles on Wikipedia).
Still, there is in fact a railroad going across Southern Africa, coast to coast, starting with Angola's Benguela railway and connecting to the “ligne du Katanga” in Congo and further to Zambia, Zimbabwe, Mozambique, Tanzania and South Africa.
I remember watching a documentary about rail transport in Angola, everything was in a very poor state after the civil war with maybe a handful of old locomotives remaining and damaged tracks. Some work has been done to improve the situation but I don't think there are trains all the way to Congo at this time, let alone reliable passenger services.
On the Congolese side, things are most likely in very poor condition as well but I believe there are trains to Zambia and further to the Indian Ocean coast (in Tanzania or in Mozambique over Zimbabwe). Possibly no passenger service either, certainly no uninterrupted service at the trans-Siberian standard. There is also a railroad from Matadi to Kinshasa but it's only barely operational, with no connections further inland.
Besides, Congo or Angola are really not recommended for tourists, people from my family who come from the region don't want their own children to go there so nothing really useful for travellers at this time but but at least the railroad exists and some day things might get better (hopefully not only for visitors).
A more realistic option could be to travel by rail in South Africa. Of course, it feels a bit like cheating because the distances are smaller but it looks like there are nice trains linking two oceans.