What is a secondary market?
As per PSE:
exchanges and OTC markets where securities are bought and sold subsequent to original issuance which took place in the primary market. Also called "aftermarket". source: www.pse.com.ph
So secondary market refers to the the next change of hand from the original source. So in the case of stocks the origin was from the company and the one traded in the stock exchange is already the second change of hand thus stock markets are often called secondary market.
When the company issued the stocks to one of its subscriber that is called the first market. When the particular stock is listed in an exchange and the subscriber/investor sells his stocks through the stock exchange there is a change of owner of the stock thus it is deemed that such transaction is after the first issuance.
In the case of IPO it is considered as a primary market since banks only act as underwriters of the company that is why the transfer from the underwriter bank to an investor in an IPO is not a secondary market. It only becomes secondary market when the investor will trade his newly acquired stock.