What it does
A market order says: buy or sell now, at whatever the best price is. It prioritises speed over price. In an order book, it takes the best available orders on the other side until it is filled. A buy market order lifts the lowest asks, and a sell market order hits the highest bids.
The price you actually get
Because it takes whatever is available, the average price can be worse than the last quoted price, especially for large orders. If the best ask only has a small quantity, the rest of your order fills at higher prices further up the book. That difference between the expected and executed price is slippage. In a thin or fast-moving market, it can be large.
The spread as a cost
A market order always crosses the spread: you buy at the ask and sell at the bid. The spread is a cost of trading immediately, and it is wider in markets with few participants. Compare it with a limit order, which lets you wait for a better price at the risk of not trading at all.
On decentralised exchanges
A token swap in a wallet is effectively a market order against a liquidity pool. The pool's formula sets the price and moves it with every trade, so larger trades cost more per token. Wallets show the price impact and let you set a slippage limit that cancels the trade if the price moves too far before it executes. That limit is your protection against an unexpectedly bad fill.
When to use one
Use a market order when speed matters more than the last bit of price, the size is small relative to market depth and you have checked the quoted spread or price impact. For larger trades in thin markets, consider splitting the trade or using limit orders.