Falling remains one of the leading causes of hospitalization and death for the elderly all around the world. The considerable risk of falls and the substantial increase of the elderly population have stimulated scientific research on smartphone-based fall detection systems recently. Even though these systems are helpful for fall detection, the best way to reduce the number of falls and their consequences is to prevent them from happening in the first place. Therefore, our focus is on fall prevention rather than fall detection. To address the issue of fall prevention, in this paper, we propose a smartphone-based fall prevention system that can alert the user about their abnormal walking pattern. Most current systems merely detect a fall whereas our approach attempts to identify high-risk gait patterns and alert the user to save them from an imminent fall. Our system uses a gait analysis approach that couples cycle detection with feature extraction to detect gait abnormality. We validated our approach using a decision tree with 10-fold cross validation and found 99.8% accuracy in gait abnormality detection. To the best of our knowledge, we are the first to use the built-in accelerometer and gyroscope of the smartphone to identify abnormal gaits in users for fall prevention.