Orders are sent to the exchange, they are executed or not depending on the liquidity available at that time (buyers or sellers) on the stock exchange.
In a situation when there is no liquidity in any particular scrip, which means, if there are no buyers when you place a sell order, or if there are no sellers when you place a buy order, your order would be pending.