A class is a defining part of any character. It determines your position in or outside of the fortress, your role, your starting equipment and your eligibility for certain antagonist rolls. The baron can not be part of a riot, for example.
Before joining the game, you will first have to choose your class. Depending on when you join, you might get either a list of available positions, or you will have to set your preferred classes in the character menu.