I read that South Africa was largely isolated from the international community during the Apartheid era with the notable exceptions of Rhodesia and Portugal. While I understand Rhodesia and South Africa had strong relations due to similar racist policies, why would Portugal have relations with South Africa?
Up until 1975, Portugal was under the rule of the Estado Novo regime, which, unlike most of the rest of the colonial powers at the time, had every intention of holding onto their colonies indefinitely. Portuguese colonies - Guinea, Angola, and Mozambique - began to experience independence movements that turned violent in the 1960s, and the Estado Novo regime would fight tooth and nail to hold onto its colonies with varying degrees of success up until the Carnation Revolution in 1974 put an end to the regime and Portugal's colonial empire. While Portugal didn't have the same Apartheid policies in place as South Africa, they did run their colonies with the kind of paternalistic and racist policies that were fairly common in the continent up until decolonization, and the regime didn't need to have public opinion backing it like the rest of the colonial powers did.
Portuguese colonies in Angola and Mozambique shared borders with Rhodesia (modern Zimbabwe), South Africa, and South-African-occupied Southwest Africa (modern Namibia). The rebel groups fighting in these territories were often operating across borders and cooperating with eachother, so it was in the interests of all of these regimes to cooperate in fighting the rebels. Portugal was under heavy international pressure to release its colonies and would increasingly struggle as the years went on, so South African cooperation was a welcome respite. Rebel movements like SWAPO tended to cooperate with the Portuguese colonial rebels like the MPLA, so joint operations often served the immediate interests of all involved. For South Africa, there was an extra element of the cooperation, as their foreign policy during the Apartheid era hinged on the idea of preventing hostile regimes from gaining control on South Africa's borders. Later, this would morph into destabilizing hostile regimes as the friendly regimes in Rhodesia and Portugal fell. By supporting Portugal, they could keep the majority of their borders under the control of a friendly regime and deny rebels the safe base of operations they would come to enjoy during the later years of Apartheid.