"To market, to market, to buy a fresh pig" vs "To the markets" valid English?

Solution 1:

Note: I believe the essence of your question has been answered, and very effectively so, on StackExchange already. The following is merely my take on how that explanation applies specifically to the phrase "to market".

Note that in the case of "to market" it is actually logical for both sellers and buyers to use that phrase since a market has both buying and selling as its main purpose.

In the case of a hospital, the main purpose is to treat patients (and not to provide a working place for doctors and nurses) and thus a patient would go "to hospital" while a doctor would go "to the hospital".

Solution 2:

There are some contexts in which an article doesn’t appear where you might expect one. The effect, as with market, is to give the noun an abstract, universal sense. Such cases are said to be 'anarthrous'. Other words where this feature can occur are congress, conference, counsel, parliament, hospital, school and college. For further discussion, see here and here.