In parts of the USA, under certain restrictions, yes.
But not in the state of California. All non-compete agreements are void and unenforceable in CA, and employers can be fined for asking employees to sign them.
Caveat:IANAL, and free legal advice from the internet may be worth less than you pay for it.
That said, here’s what Rukin Hyland, a San Francisco-based law firm specializing in workplace claims, has to say about it: