Kindly correct me if I am wrong.
I heard the saying of Imam Ali (as) that It’s considered haram if Na-Mehrams are talking without any specific legal need.
I didn’t find any authentic reference of the quote so I’m not sure whether it’s correct or not.

It’s correct. One cannot talk with Na Mehram for talking sake