Yes, demat account is mandatory to invest in IPO.
All the shares received in IPO allotment process are transferred to the demat account. Investor can place a sell order at market price (market order) or limit price (specified price) to sell allotted shares.