In this article, the Internet of Medical Things (IoMT) framework based on Apache Spark big data processing technology is proposed for real-time analysis of health data obtained from wireless body area networks (WBANs), which is one of the most important components of IoMT. The proposed framework consists of four layers: data source, data collection, data analytics and visualization. In addition, the proposed IoMT framework is presented with two different disease prediction scenarios, diabetes and heart disease. Diabetes and heart disease prediction processes are carried out using the random forest (RF), logistic regression (LR) and support vector machine (SVM) algorithms belonging to the Apache Spark machine learning library (MLlib). The analysis of health data generated in WBANs takes place in real-time in the Apache Spark-based data analytics layer. In this study, the performances of MLlib algorithms in the real-time model developed for heart and diabetes disease are examined. The SVM algorithm with an accuracy rate of 93.33% for heart disease and the LR algorithm with an accuracy rate of 78.89% for diabetes are found to provide the best performances.