can an employer fine an employee if they arrive late to work?

My friend told me this is a regular occurrence in his place of work - if he arrives 10 minutes late for whatever reason, they yell at him and apparently make him pay a fine (?). I.e. they withhold a portion of his salary/deduct the amount as punishment for being late. My friend tells me that he's usually never late, it's just once in a blue moon sort of thing you know, how it happens to regular people. Traffic is a little heavy, you're out the door 5 minutes later than usual for whatever reason, accidentally sleeping through your alarm 10 mins etc. So it's not like it happens every day and the company is losing money, yet he is being fined.

Is this a thing? Is it legal? I've heard about this happening in other countries but never in South Africa

edit to say: he is not paid per hour worked, he's paid a flat full-time salary

second edit: SORRY I confirmed with my friend, he is actually paid hourly so my first edit is incorrect. Which I guess makes sense that he isn't paid for the time he misses, but I will just say if he's 10 mins late, the entire hour is deducted, which I still don't think is right. If he works over to make up the time, the fine is still deducted.