I would guess that markets are like large groups of people selling stuff, well that sort of thing certainly predates writing.
Ancient city states always had a central marketplace area (agora, forum, etc) as did the mesoamerican city states. So the market in this sense came into being with the city.