Foreigners can claim for maternity benefits just like South African residents/citizens.
There are a few things to consider though.
1. The applicant needs a valid passport and work visa. Refugee documents are not considered unless they are accompanied by a valid passport
2. Just like a South African the applicant has to contribute to UIF in order to be able to claim
3. Claims from anybody who doesn't have a 13-digit ID number are processed in Pretoria and take a bit longer to get approved. Expect a claim to be submitted after about 2 months.
4. Although most claims from foreigners are approved without a glitch by the Department of Labour occasionally wants to verify other documents as well. These include copies of old passports (if they were used for a previous UIF claim), marriage certificates, the applicant's birth certificate to name but a few. If additional documents are requested the approval time can expand. Luckily we will be in touch with the relevant officials and will follow up until your claim is approved.