Food poisoning caused by toxins produced by Staphylococcus aureus (S. aureus) is a significant global public health concern, impacting both developing and developed countries. One effective method for detecting S. aureus is the use of electrochemical aptasensors. This study introduces a highly sensitive and selective electrochemical aptasensor designed for detecting of S. aureus bacteria. The aptasensor incorporates ferrocene (Fc) as an electrochemical signal tag, which is covalently bonded to a zeolitic imidazolate framework-8 (ZIF-8). To enhance the performance of the working electrode, a nanocomposite of three-dimensional reduced graphene oxide and chitosan is used to create a nanomaterial film with a large surface area and excellent conductivity. The S. aureus-specific aptamer sequence is immobilized as the bio-recognition element, and cDNA-ZIF-8-Fc is hybridized with the immobilized aptamer. Differential pulse voltammograms of the modified electrode are recorded before and after the interaction between the immobilized aptamer and S. aureus. The changes in peak current serve as the analytical signal for the quantitative measurement of S. aureus. The designed aptasensor can detect S. aureus within a linear concentration range of 15.0 to 1.5 × 107 CFU mL−1, with a limit of detection (LOD) of 5.3 CFU mL−1. The results demonstrate that the aptasensor effectively quantifies S. aureus selectively in the presence of other bacterial species. Additionally, satisfactory results are obtained when measuring S. aureus in tap water and milk samples.