Some religions (notably Islam) mandate that people perform ablutions before praying. During the prayer, it is also required to stand, kneel, bow, and prostrate several times.
Washing makes sense because back in those days, bacteria and viruses were neither known, nor could be understood by the average person. They had no microscopes, so convincing people of invisible creatures that surround us that can harm us was a difficult task at best. It was much easier to just require people to wash as part of the prayer to keep people sanitary. And since most of the people where these religions began lived in desert areas, washing not only was a way of ridding people of germs, but also cleaning off the sand that invariably gets into their nooks and crannies. Moreover, requiring them to pray several times a day, keeps them clean all day long.
The physical movements involved with the prayers also make sense. While some members of society would get plenty of exercise from hunting or farming, there were still plenty of people who remained behind and could get out of shape. Requiring people to repeat some simple but muscle-using movements several times a day was an effective way of keeping the populace physically fit.
Granted it would be ideal if one could just explain things to do to keep a person healthy instead of having to trick them, but back then it was pretty difficult (just look at how well it worked out for so many prophets and scientists). Besides, today we do teach people things to keep them healthy and nobody listens. Maybe parents should take a cue from the past and find a way to trick their kids into eating healthy, exercising, and washing.