Sabre, I think what you are asking about is a hostile takeover attempt.
If you Google something like "preventing hostile takeovers," you'll get lots of good sites that explain ways companies can prevent your scenario from occurring, where a company tries to take control of another company by purchasing shares on the open market.