This study employs machine learning (ML) techniques to predict pedestrian compliance at crosswalks in urban settings in Jordan, aiming to enhance pedestrian safety and traffic management. Utilizing data from 2437 pedestrians at signalized intersections in Amman, Irbid, and Zarqa, four models based on different ML algorithms were developed: an artificial neural network (ANN), a support vector machine (SVM), a decision tree (ID3), and a random forest (RF). The results have shown that local infrastructure and traffic conditions influence pedestrian behavior. The RF model, with its excellent accuracy and precision, has proven to be an excellent choice for accurately predicting pedestrian behavior. This research provides valuable insights into the demographic and spatial aspects that influence pedestrian compliance with laws and regulations in the local environment. Additionally, this work highlights the ability of ML algorithms to improve urban traffic dynamics. Policymakers and urban planners, particularly with the rise of theories and trends toward the humanization of urban roads, should firmly establish this understanding among themselves to create environments that make pedestrians safer. This strategy could be a measurable solution for international urban situations if future research focuses on integrating these prediction models with real-time traffic management systems to improve pedestrian safety dynamically.