I’ve taken and assisted for classes that had “mandatory” attendance. In the sense that missing classes would come out of your grade.
Sometimes it was implemented as a direct role-call. Some classes have a “participation” component which is really just a fuzzy attendance grade. Some classes have random graded in-class quizzes, which also function as a stochastic attendance check.
Generally I hate all of these things IMO low attendance is the instructor’s last, most dramatic barometer to indicate poor instruction, and subverting this measurement is a terrible idea. But it is definitely different for k-12!