First of all, it's not so obvious that this is prohibited in the first place. Pesachim 111a says that a person is not allowed to walk between two woman or have a woman walk between you (a man) and a friend, and the context there implies that this is a dangerous thing to do (probably because of something related to magic or ruach ra'ah, see Eliyah Rabbah 3:10 and Shulchan Aruch Harav Hil. Shemiras Guf Vehanefesh 9). The Gemara in Horayos 23b13b also writes that doing so would cause someone to forget his Torah learning. Based on this, because there is a prohibition to forget one's learning, R. Nosson Gestenter (Shut Lehoros Noson 1:59:14) and R. Yosef Chaim Sonnenfeld (Shut Salmas Chaim Siman 83 and 90) both write that there is a Biblical prohibition to walk in between two women. However, R. Sonnenfeld also writes that perhaps one doesn't need to be so careful about this because we can assume that most women are not niddos, and that is where the real danger lies.
To the point, though, the Ben Yehoyada on the Gemara writes that nowadays, when we don't encounter demons and the like (which is the context of the Gemara in Pesachim), there's no need to prohibit walking between two women; the Gemara was only speaking for their times when sheidim were around more. R. Aryeh Lebowitz says that in general, we are not usually so concerned for all of the Gemara's medical (and magical) advice, and because the Rambam and Shulchan Aruch don't quote this halacha, one does not need to worry about it.
If you are worried about it, though, it may be whatever problem arises from this can seemingly be solved either by saying a pasuk (or series of pesukim) that begins and ends with אל or לא, as the Gemara in Pesachim states (and Maharsha in Horayos implies that this solves the problem for forgetting Torah as well, though perhaps not). Additionally, the book Halachically Speaking II by R. Moshe Dovid Lebovitz quotes that holding an object in one's hand also works to make this permitted.