In Spain it became common after the last university reform, about 15 years ago. IMO it's counterproductive. If a student doesn't want to go to class and you force them, they probably won't be paying attention but just wasting time with social networks or whatever other distraction, and they can even distract those that want to attend. And I don't even feel morally justified to tell them to stop wasting time (as long as they're silent, at least) if they're forced to be there.