Objective This study aimed to determine the effect of the theory of planned behavior-based education program on promoting the urinary tract infection prevention behaviors in pregnant women. Methods The present study was a randomized controlled trial in which 100 pregnant women, who visited the healthcare centers of Zarinshahr City, were randomly divided into two groups, intervention and control. Five education sessions based on the theory of planned behavior were held for the intervention group. Results After implementing the educational intervention, the mean scores of knowledge and constructs of the theory of planned behavior significantly increased in the intervention group over time (P < 0.001). After the educational intervention, the incidence of urinary tract infections (UTI) was 4.3% in the intervention group and 21.3% in the control group. Conclusion In this study, the use of methods such as group discussion and role playing promoted attitudes, perceived behavioral control and subjective norms of pregnant women, and as a result, UTI in women in the intervention group was reduced.