Good question. The partition you ask about is called a “mechitza”, meaning “separation”. The requirement to have a separation between men and women dates back to Biblical times. It is mentioned in the Babylonian Talmud with regard to separation of men and women in the Temple (Succah 51b, 52a). There are a number of reasons given for this:
1. To prevent there being a "light" atmosphere during prayer. The occasion should not be one for socializing, and conversation. The atmosphere during prayer should be serious, and one way to achieve this is by creating a separation between men and women.
2. So as not to cause those who are unmarried to feel “left out”. We come to synagogue to relate to God as Jews, not as spouses, husbands, wives, fathers and mothers. With a mechitza in place spouses do not sit together. We are thereby more of a “congregation” than merely groups of individuals.
3. To promote modesty, and to prevent the distraction from prayer to both men and women due to the presence of members of the opposite sex, to whom there is a natural attraction.
A mechitza may separate in different manners. It may separate between the front and back of the synagogue, or it may separate the left and right sides of the synagogue, while some synagogues have a balcony above the men which allows for separate seating. The women’s section in each of these cases is known as “ezrat nashim” — “the women’s gallery”.
There is much literature on the subject, and when I asked a great Rabbi in Jerusalem for some reading material on the subject he lent me a copy of a book that was entirely about the subject of mechitza and was more than 1,000 pages long!