The primary function of compact bone is to provide structural support and protection. It supports the weight of the body and withstands mechanical stress. Additionally, compact bone acts as a reservoir for minerals such as calcium and phosphate, which are essential for various physiological processes.