Shareholders are not legally obliged to enter into a shareholders agreement. They are entered into voluntarily to protect the shareholders' investment in the company they 'own' and to provide clarity and certainty to the relationship between the shareholders (over and above the more generic provisions usually found in the Articles of Association).
It is recommended that all companies with more than one shareholder enter into a shareholders agreement. Having a clear agreement in place lets the shareholders know where they stand in relation to their investment in the company.
Many costly disputes have been resolved and problems avoided as a direct result of entering into a shareholders agreement.