Even as a non-resident, you are obligated to declare the Capital Gain or Capital Loss when selling immovable property in South Africa. Where the seller of immovable property is a non-resident and the gross sales price exceeds R2 million, the purchaser has an obligation to withhold 5% of the purchase price from the seller (if a natural person)*, and pay such withheld portion to SARS as provisional Capital Gains Tax. The seller is however entitled to apply to SARS for a directive for no withholding or a reduced withholding tax.
* If the seller is an entity, a different rate applies.