This Qur'anic aya (verse) seems to indicate that free-mixing and socialization between the sexes is prohibited:
O you who believe! Enter not the Prophet's houses, except when leave is given to you for a meal, (and then) not (so early as) to wait for its preparation. But when you are invited, enter, and when you have taken your meal, disperse, without sitting for a talk. Verily, such (behavior) annoys the Prophet, and he is shy of (asking) you (to go), but Allah is not shy of (telling you) the truth. And when you ask (his wives) for anything you want, ask them from behind a screen, that is purer for your hearts and for their hearts. And it is not (right) for you that you should annoy Allah’s Messenger, nor that you should ever marry his wives after him (his death). Verily! With Allah that shall be an enormity.
From the above aya (verse), the scholars usually conclude that Allah has forbidden the believing men from mingling with the prophet’s wives. A screen or veil should be placed there in between the men and prophet’s wives while conversing with them. Hadiths in this regard attest to the prohibition of free-mingling or mixing of men and women:
Narrated Ibn Abbas: That he heard the Prophet saying, "It is not permissible for a man to be alone with a woman, and no lady should travel except with a mahram (i.e. her husband or a person whom she cannot marry in any case for ever; e.g. her father, brother, etc.)." Then a man got up and said, "O Allah's Apostle! I have enlisted in the army for such-and-such Ghazwa and my wife is proceeding for Hajj." Allah's Apostle said, "Go, and perform the Hajj with your wife."
Narrated Qaza'a, the slave of Ziyad: Abu Said who participated in twelve Ghazawat with the Prophet said, "I heard four things from Allah's Apostle (or I narrate them from the Prophet ) which won my admiration and appreciation. They are: 1. "No lady should travel without her husband or without a Dhu-mahram for a two-days' journey. 2. No fasting is permissible on two days of 'Id-al-Fitr, and 'Id-al-Adha. 3. No prayer (may be offered) after two prayers: after the 'Asr prayer till the sun set and after the morning prayer till the sun rises. 4. Not to travel (for visiting) except for three mosques: Masjid-al-Haram (in Mecca), my Mosque (in Medina), and Masjid-al-Aqsa (in Jerusalem)."
Abu Huraira (Allah be pleased with him) reported Allah's Messenger (may peace be upon him) as saying: It is not lawful for a Muslim woman to travel a night's journey except when there is a mahram with her.
Abu Huraira (Allah be pleased with him) reported Allah's Apostle (may peace be upon him) as saying: It is not lawful for a woman who believes in Allah and the Hereafter to undertake a day's journey except in the company of a mahram.
Ibn 'Abbas (Allah be pleased with them) reported: I heard Allah's Messenger (may peace be upon him) delivering a sermon and making this observation:" No person should be alone with a woman except when there is a mahram with her, and the woman should not undertake journey except with a mahram." A person stood up and said: Allah's Messenger, my wife has set out for pilgrimage, whereas I am enlisted to fight in such and such battle, whereupon he said:" You go and perform Hajj with your wife."
There are further incidents that occurred during the life of Muhammad that cement the prohibition between intersex socialization:
Narrated Abu Said Al-Khudri On 'Id ul Fitr or 'Id ul Adha Allah's Apostle (p.b.u.h) went out to the Musalla. After finishing the prayer, he delivered the sermon and ordered the people to give alms. He said, "O people! Give alms." Then he went towards the women and said. "O women! Give alms, for I have seen that the majority of the dwellers of Hell-Fire were you (women)." The women asked, "O Allah's Apostle! What is the reason for it?" He replied, "O women! You curse frequently, and are ungrateful to your husbands. I have not seen anyone more deficient in intelligence and religion than you. O women, some of you can lead a cautious wise man astray." Then he left. And when he reached his house, Zainab, the wife of Ibn Masud, came and asked permission to enter It was said, "O Allah's Apostle! It is Zainab." He asked, 'Which Zainab?" The reply was that she was the wife of Ibn Mas'ub. He said, "Yes, allow her to enter." And she was admitted. Then she said, "O Prophet of Allah! Today you ordered people to give alms and I had an ornament and intended to give it as alms, but Ibn Masud said that he and his children deserved it more than anybody else." The Prophet replied, "Ibn Masud had spoken the truth. Your husband and your children had more right to it than anybody else."
Ibn Hajr offers the following observations about this hadith:
"The fact that he went to the women separately shows that the women were assembled separately from the men and were not mixed in with them."
Fath al-Bari (2/466)
Narrated Um Salama: Whenever Allah's Apostle completed the prayer with Taslim, the women used to get up immediately and Allah's Apostle would remain at his place for someone before getting up. (The sub-narrator (Az-Zuhri) said, "We think, and Allah knows better, that he did so, so that the women might leave before men could get in touch with them)."
Ibn Hajr comments:
"In the hadith, we see that it is disliked for men and women to mix on the road. How much more, then, should such mixing be avoided inside of houses."
Fath al-Bari (2/336)
The Prophet (peace be upon him) never shook hands with an unrelated woman. Umaymah b. Raqiqah said: "I came to the Prophet (peace be upon him) with a group of the women of Madinah to swear fealty for Islam. The women informed Allah's Messenger (peace be upon him) that they wished to swear fealty to him. The Prophet (peace be upon him) said: 'I do not shake hands with women. The way I accept the pledge from one woman is the same as with one hundred women."
al-Muwatta', Sunan al-Tirmidhi, Sunan al-Nasa'i and Sunan Ibn Majah
There is also material in the hadith to the effect that women may not sit with unrelated males if she is wearing perfume:
The Prophet (peace be upon him) said: "Any woman who puts on perfume then goes and passes by some men to let them find her scent is a type of adulteress."
Musnad Ahmad, Sunan al-Tirmidhi, Sunan Abi Dawud, and Sunan al-Nasa'i with a sound chain of transmission
With reference to the above material and more besides it, Islamic jurists have traditionally come to the conclusion that free-mixing of the sexes is not allowed in Islam.
Imam Nawawi, a famous Jurist in Islam gives his verdict in his Majmu’:
"Ibn al-Mundhir and others maintain that it is a matter of unanimous agreement that women are not obligated to attend the Jumu'ah prayers. However, his argument that this is because it brings about the mixing of women and men is not correct. The attendance of women at the Jumu'ah prayers does not necessarily bring about such mixing since the women stay behind the men."
"One of the vilest innovations, that some ignorant people today are involved in, is the habit of lighting candles on Mount 'Arafah on the ninth night. This behavior is gravely misguided and is full of improper goings-on such as the mixing of men and women."
Another Jurist Sarkashi is of the same opinion of Nawawi:
"The judge should try women separately from men since people tend to crowd together in the courtroom. It is quite obvious that the mixing together of men and women under such crowded conditions is conducive to temptation and other distasteful consequences."
The only exception to all of the above information is in the case of Mahram men. Mahram refers to those whom marriage is prohibited in Islam. These include fathers, uncles, brothers and close blood relatives.
Recent Fatwas from Muslim scholars underline the contention that free-mixing of men and women is not allowed in Islam under any circumstances, to this very day:
Question: What is Islam's view of women working alongside men?
Answer: It is known that when women go to work in the workplaces of men this leads to mixing with men and being in private with them. This is a very dangerous matter that has dangerous consequences and negative results. It is in clear opposition to the texts of the Shariah that order the women to remain in their houses and to fulfill the type of work that is particular for her and upon which Allah has fashioned her nature, which is far from the place where she will mix with men.
The clear, authentic evidences that indicate that it is forbidden for men and non related women to be in private together and for men to look at women are numerous. There are also much evidence that what leads up to those forbidden ends are also forbidden. The evidences are many, clear and decisive that the mixing between the sexes is forbidden as it leads to negative and blameworthy results.
Shaikh AbdulAziz Bin Bazz, 'Islamic Fatwas regarding Women', Page No. 313
Is it allowed for Muslim women to attend educational meetings and fiqh study sessions in the mosques?
Answer: Yes. It is allowed for her to attend educational meetings, regardless if they are related to practical matters or to matters of faith and monotheism. This is given the condition that she is not perfumed or displaying her beauty. She must also be distant from the men and not mixing with them.
Question: What are the permissible types of work for a Muslim woman to work in without being in contradiction with the teachings of her religion?
The places of work for women are those places that are specific for women. For example, she may work in woman's education, either in administration or otherwise. She can also work in her house by being a tailor for women and so forth. It is not allowed for her to work in areas which are exclusive for men because in that case she must mix with men and this is a great source of trial and temptation that one must beware of.
Shaikh Ibn Uthaimin, 'Fatwas regarding Women', Page No. 364