Okay, none of these were good enough answers IMO.
The stock market IS a primary market. The primary purpose is for companies to raise capital via a primary IPO or a secondary IPO to either cash out the private shareholders and/or raise capital for capital expenditures, operations, expansion, acquisitions, mergers, etc. All of the real value is generated long before a primary IPO. Secondary IPOs are typically the domain of pipe dream hucksters in the mining and biotech industries that issue dilution shares to finance ongoing “operations”.
The secondary purpose of the stock market is that it provides pricing signals from millions of individuals so that proper valuations can be imputed to a company and its shares which is invaluable for all kinds of things, especially mergers and acquisitions. This also feeds back into the private market for setting financing round valuations similar in kind to how real estate comparables is done.
Of course there’s been a fundamental structural change due to Sarbanes-Oxley. Private companies no longer IPO and stay private as long as possible to avoid the overly-burdensome regulation, so that traditionally crony world is being opened up to wider public access.
The current ICO (Initial Coin Offering) bubble is a good illustration of what an unregulated primary market is like. You have no pre-existing value to unlock. No business plan in most cases. No rights as a shareholder as you aren’t one. No legal recourse, especially if its an illegal security and not an app token or cryptocoin. But it’s showing the eventual future of IPO’s.