A solution combining state observer (SOB) with Discrete Sliding Mode Control (DSMC) is presented to solve the problem of inventory shortage or backlog in upstream and downstream enterprises of the supply chain caused by contingency conditions. Firstly, based on the specific sales mode of the supply chain system and the logical relationship of inventory parameters, the corresponding dynamic model of the inventory system is established under reasonable assumptions, and relevant parameters are introduced to represent the impact of contingencies, and the dynamic model of inventory system under contingencies is established with the bullwhip effect. Then, the discrete sliding mode control (SOB-DSMC) based on the state observer is designed to compensate for the impact of emergencies on the supply chain inventory system adaptively while ensuring the stability of the system. Finally, based on market research and reasonable assumptions, simulation experiments are carried out. The simulation results show that the designed control system can better cope with emergencies in different situations, and can significantly improve the supply chain within 5 days after emergencies occur. The inventory situation of upstream and downstream enterprises in the system has reduced the maximum inventory fluctuations of manufacturers, distributors, and retailers by 77.13%, 60.67%, and 44.61% respectively, and fully restored to normal operation within 20 days, effectively solving the inventory backlog of upstream and downstream enterprises in the supply chain and out of stock issues. It can be seen that the SOB-DSMC method can guide the upstream enterprises in the supply chain to formulate reasonable production, shipping, and purchasing strategies, and provide theoretical reference and coping methods for the supply chain system to smoothly survive emergencies.