It's there as a division between the men and the women during prayer. It's basically to help us focus on prayer, and not on other things.
The law requiring a separation, a "mechitzah," is mentioned in the Babylonian Talmud, Tractate Succah 51b, 52a. There are a number of reasons given for this:
- 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 or mothers. With a mechitzah, spouses do not sit together. That way, we are more of a congregation than groups of individuals.
- To prevent there being an atmosphere of socializing, and conversation during prayer.
- The atmosphere during prayer should be serious. One way to help achieve the proper atmosphere is by creating a division between men and women.
- To promote modesty, and to prevent the distraction from prayer to both men and women from the presence of members of the opposite gender, to whom there is a natural attraction.