The emergency departments (EDs) in most hospitals, especially in middle-and-low-income countries, need techniques for minimizing the waiting time of patients. The application and utilization of appropriate methods can enhance the number of patients treated, improve patients’ satisfaction, reduce healthcare costs, and lower morbidity and mortality rates which are often associated with poor healthcare facilities, overcrowding, and low availability of healthcare professionals. Modeling the length of stay (LOS) of patients in healthcare systems is a challenge that must be addressed for sound decision-making regarding capacity planning and resource allocation. This paper presents a machine learning (ML) framework for predicting a patient’s LOS within the ED. A study of the services in the ED of a tertiary healthcare facility in Uyo, Nigeria was conducted to gain insights into its operational procedures and evaluate the impact of certain parameters on LOS. Then, a computer simulation of the system was performed in R programming language using data obtained from records in the hospital. Finally, the performance of four ML classifiers involved in patients’ LOS prediction: Classification and Regression Tree (CART), Random Forest (RF), K-Nearest Neighbour (K-NN), and Support Vector Machine (SVM), were evaluated and results indicate that SVM outperforms others with the highest coefficient of determination (R2) score of 0.986984 and least mean square error (MSE) value of 0.358594. The result demonstrates the capability of ML techniques to effectively assess the performance of healthcare systems and accurately predict patients’ LOS to mitigate the low physician-patient ratio and improve throughput.