They are not contractually obligated to grow at a certain rate.

However, if the majority of your shareholders are members of the public looking to earn a return, they're your boss. You might be CEO, but if your priorities aren't their priorities, they'll replace you. Even if you own the majority voting control in the company, there's a certain amount of good-faith effort you need to put into growing the profits of the company. In most jurisdictions, a public for-profit company is organized with the belief that the company exists to create as much profit as it reasonably can and shouldn't be operating in a way that avoids that. That doesn't mean doing scummy things or things that might realize short-term profits at the expense of the brand, but sometimes it becomes clear that a company is no longer operating with its (potentially minority) shareholders in mind.

There's actually a type of corporation that specifically notes that maximizing profit isn't the goal of the enterprise (https://en.wikipedia.org/wiki/Benefit_corporation). Twitter could have been formed as a B-Corporation and told its investors that it might make profit, but that profit wasn't its only goal.

But the thing is that Twitter isn't just making too little money. It's losing money. It would be like a coffeeshop that sold coffee for 10¢ a cup with 50,000 customers/mo and rent of $8,000/mo. They'd bring in $5,000 from their customers and be $3,000 in the hole at the end of the month. Now, there are a few ways to change that situation. 1) Get more money per customer. Twitter could sell more or better ads or you could give them money. That's hard. 2) Get more users. If Twitter earns $X/user/month in revenue and they're able to get double the number of users, that's double the revenue. If costs don't go up linearly with users, their situation will get better. If the coffeeshop gets 100,000 customers/mo, they'd be making $2,000/mo. 3) Twitter can lower costs. They can fire excess employees working on marginal projects; they can get rid of app features that might be computationally expensive to deliver.

The issue with many startups isn't always growth or investors, but even keeping one's head above water.

Now, even if Twitter can keep its head above water, is that enough? If Twitter became a non-profit and just advertised itself as a public service to the world, would that be enough to keep users around? So many companies are gunning to take down Twitter. Would Twitter survive if it slimmed down its staff and just kept Twitter alive? Would users migrate to other services that offered new, cool things?

I feel like Wikipedia is the only really high-traffic non-profit, but they're doing something that requires a lot less engineering (ie. most of the page can be easily cached and is the same for all users vs. Twitter).

The thing is that it's hard to bootstrap services with huge network effects like Facebook or Twitter and keep a small staff. It's often a winner-take-all (or most) market. Remember Pownce? Probably not. There were lots of microblogging companies and Twitter destroyed them all. To do that, they needed to staff-up as you handle scaling issues and add features. Once you're big, you want to keep focusing on growth since layoffs are demoralizing and if you stop growing, what's to stop a new company from coming along and knocking you off?

It's easy to think that Twitter could be run with less of an eye for growth or profit, but given that it's losing money right now and that can't continue forever, it at least needs to get to a head-above-water place. The most promising ways of getting there are things like getting more users, cutting costs like staff, and figuring out how to get more revenue per current user. In fact, one could argue that the layoffs are part of Twitter not prizing growth above all else. They're trading growth (that could be driven by those employees) for cost (the salaries of those employees). Twitter is going the route of the less-growth, slimmed-down company looking to just keep chugging along. But even then, Twitter needs to get its head above water and this is kinda part of that (unfortunately).