It depends. A hostile takeover is similar to the acquisition of a business, the only difference being that the target company vehemently opposes the deal. There are two ways for hostile takeovers to occur, either through tender offers or proxy fights. Tender offers are outside entities offering to buy shares from shareholders or companies at a higher premium and thereby getting a majority. Proxy fights happen internally between groups of shareholders.
The legality of hostile takeovers is a hotly debated issue among businessmen, economists, lawmakers etc. There is no real definition of a hostile takeover and there is no tangible way to prevent it. There are defense mechanisms which get creative with every passing day and attorneys are great at coming up with them leading to a decrease in hostile takeovers over the years. The only time a hostile takeover can be taken to court is if the outside entity is using internal information for creative strategies against the management.
The good side to a hostile takeover is that it checks underperforming companies and the new management can actually work better than the old one and the company can take advantage of and realize their goals better. The bad side is that companies can fall flat on their face with insensitive new management. For example, when AOL acquired Time Warner they lost around 200$ Billion in value in a period of two years. Therefore, it’s tough to say whether hostile takeovers should be illegal or not. The decreasing intensity of hostile takeovers since the 1980s do tell, that in the near future, it’ll become a thing of the past.