As far as I knew Islam specified behavioural norms and dress codes for men and women, but whether any text specified segregation I was not aware. Quite honestly, I always assumed that it was probably part of the hadith, and, never gave it another thought since it did not really impact me.
Browsed through a number of websites and this is what I have understood:
Both men and women are allowed to pray in the Mosque in the same congregational prayer. However, when they do pray, the men line up behind the Iman, then the children and finally the women.
As per this website (http://www.islamonline.net/), this was the way that Muslims prayed, seated behind the Prophet, and the practice has continued since, but the Prophet did not ordain a curtain / wall between the men and the women praying with him.
According to the Shari`ah, it is not required to have a partition, temporary or permanent, between men and women in the Masjid. However, it is expected that the women would be appropriately dressed in an Islamic way.
Another hadith talks about Asma, the daughter of Abu Bakr who said,
I heard the Apostle of God say, "One of you who believes in God and in the Last Day should not raise her head until the men raise their heads (after prostration) lest she should see the private parts of men."(Sunan Abu Dawud, No. 850).
This implies that there was no segregation but a norm of behaviour specified and the order of seating defined - women behind the men.
From what I have read on the net (and I would be very happy if someone who reads this has any idea about this) the Quran also does not specify segregation but seeks to reduce physical proximity that may lead to improper (?) behaviour.
I guess somewhere in the later years, a Victoran sense of morality prevailed or more likely, some cleric probably interpreted the texts in a conservative manner which resulted in praying areas being segregated for men and women.