It's a big class so, if everything else is even, the chances of any one student being called are small (proportional to the class size). Despite the small chance, he ends up being called anyway. He's "lucky".
A chance of winning the lottery are very slim. The joke is that since he gets called in class even if the chances are small, he might win the lottery too even if the chances are small.