The company just buys back the shares. It’s essentially a cash bonus.
But there are limits to how many non-insider (e.g. former employees), non-accredited investors a company can have before it is required to go public. For this reason a lot of companies do try to make it mandatory and/or offer sweet deals to buy the shares back upon leaving the company.
I thought that limit was some trivial number. I thought the much larger number (2,000 IIRC) was made up of investors who were either insiders or accredited investors.
Companies often get around this by not doing everything possible to prevent an employee from becoming a shareholder on record. E.g. settling option contracts for cash.