Reference: http://mufti.af.org.sa/ar/content/حكم-العلاقة-بين-الجنسين
Question: What is the ruling regarding friendship between the two genders, bearing in mind it is with a righteous intention, and not [anything] bad?
Response: It is obligatory upon the man not to get together with an unrelated woman [for whom he is not a mahram]. And it is obligatory upon him to beware of being alone with a woman at any meeting or conversation, because the Prophet ﷺ said:
And He ﷺ said:
«Beware of entering upon women.» It was said [by one of the Companions]: “O Messenger of Allaah, what about the brother-in-law?” He said:
«The brother-in-law is death!» – transmitted by al-Bukhaaree, Muslim, at-Tirmidhee, Ahmad, ad-Daarimee.
And Allaah (Ta’aala) said to the wives of the His Prophet:
So that which is befitting is for the man to take precaution and keep away from conversing with women, for indeed conversing with women could lead to that which is more harmful than that. And Shaytaan flows through the son of Aadam as the blood flows through his veins, so to close the means to harm are from the reasons [which lead] to safety with the towfeeq of Allaah. And whoever opens the door to harm for himself, then it is feared he may fall into it, except for he whom Allaah protects. We ask Allaah for protection and guidance.