Going public wasn't required by their investor count, but they would have had to have audited financials, so the benefits of remaining private would have been reduced anyway:
Facebook passed the 500 shareholder mark back in 2008 and got an exemption.
I've had no luck finding out why they then had to observe the rule by 2012 though.
Passing the 500 mark means you have to hand in SEC filings, nothing more.
No. No company "has" to go public
There needs to be some liquidity event for employees who own stock. Equity is a big part of compensation in a startup. No company "has" to go public, but they could lose a significant portion of their workforce if they don't.