Why does exchange charge penalties for margin shortfall?

Exchange is responsible for ensuring settlement for all trades, so it tries to ensure that all clients and brokers are covered against potential losses and defaults. Since Equities & Derivatives are leveraged products, the quantum of losses can spiral out of control very quickly. Hence, the exchange levies penalties to ensure compliance with the margin requirements.