We are not to place ourselves in danger of straying after heretical ideologies by having an undue fascination with them. The Sifra explains this mitzvah by explaining human nature: if we start investigating these heretical ideas, they will plant seeds that will germinate in our brains, after which it’s very hard to rid ourselves of nonsensical notions we may have absorbed. (It’s hard to un-think something.) A person who occupies himself with such philosophies places himself at risk of being swayed by them.
God created us and it is fitting to serve only Him. Idols are an affront to Him, so it is inappropriate to take space from our brains that should be used to serve Him and give it instead to some heretical ideal. (See Talmud Shabbos 149a.) This is unique in that one can not normally sin with thoughts alone. This mitzvah is an exception to that general rule, as merely giving room in our heads to an idolatrous practice constitutes a violation. (See Talmud Kiddushin 40a.)
This mitzvah applies to both men and women in all times and places. It is discussed in the Talmud in tractate Shabbos on page 149a. It is codified in the Mishneh Torah in the second chapter of Hilchos Avodas Kochavim. This prohibition is #10 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #16 of the 194 negative mitzvos that can be fulfilled today as listed in the Sefer HaMitzvos HaKatzar of the Chofetz Chaim.