It's legal because the board is in charge of the company: they are the ultimate authority. Being in charge, they can set various rules, including rules barring employees from being on the board or attending meetings, the same way that a company's president could bar employees from executive meetings between her and the VPs. It's not the law prevents employees from attending board meetings, etc., it's that there is no inherent legal right to do so--so if the people in charge of the company don't want employees there, employees may not attend.