Earlier quoted context omitted.
In Norway there's laws for that, but other places do it even without them. You just retrain the person to do something else. He might take a job of a temp that was hoping to get a fast contract (instead of a few weeks at a time during trial period). Other than that, it's good for the person (not losing job) but also for the company - you get a tried person with good work ethics that comes on time. It's not zero cost…
Why do the laws exist if its better for (almost) everyone involved? Without the laws why would people not do it that way if its the better approach?
And later other trades did the same. Some of the things in contracts trickled down to the law. But still some laws apply only to companies where at least a certain % (is it 50%?) are unionized.
The general picture is more or less like that, but please verify the details.