No, it really is true; it is a legal obligation of the corporation to its shareholders that is enforced through legal action -- both corporations as such and their specific duties to shareholders are products of laws, not market forces unmediated by law.
They have obligations to their shareholders in so far as they are not allowed to attempt to defraud or surreptitiously act against them them in some way. They have to be honest.
They have no obligation to minimize costs. A company director cannot be taken to court for not using the cheapest labour source available, the shareholders would have to vote them out in which case they just lose their job.
There are plenty of publicly traded companies that do not cost minimize in all areas.
I think you're splitting hairs here, and you understand what the intent of my statement was, but I'll take your point about my choice of words.
I agree there are certainly exceptions, but most corporations put profit above all else, and if they don't, then as you say, the executives or the board will be fired and replaced with people who will.
"Legal obligation" may have been inaccurate wording, perhaps "structurally obligated" or "internally compelled" then?
This really isn't true, it is market forces that incentivise this behavior; not laws.