There are two mitzvos against transvestism, one prohibiting men from wearing women’s clothes and one prohibiting women from wearing men’s clothes. The one for men, in the next mitzvah, says “lo yilbash gever simlas isha,” “a man shall not wear a woman’s garment.” That’s pretty direct. The mitzvah directed at women, however, is more vague. “Lo yihiyeh kli gever al isha” means “a man’s utensil shall not be upon a woman.” The term “kli” (“utensil”) includes more than just clothing. The Targum Onkelos understands the term to include weapons, which were exclusively used by men, while the Targum Yonason understands it to include tallis and tefillin. In any event, it certainly includes garments that are recognized as exclusively male (as pants were for most of history).
Of course, the practical application of this mitzvah involves many details. Can a woman wear a man’s garment (or vice versa) for protection from the elements? How about for “Purim shtick?” Are pants still considered an exclusively-male garment and, if so, what permits women to wear them even in private? Such questions are beyond our scope and are matters for further study. (Might this author humbly recommend his own work, “The Tzniyus Book” for more on this topic?)
The reason for this prohibition is to serve as a barrier to immorality. Without separate men’s and women’s modes of dress, it would lead to excessive intermingling of the sexes, men passing as women and women passing as men. (In the 1960s, when boys started wearing their hair long, a common gag in sitcoms and comic strips was for the boys to be indistinguishable from the girls, so we can see signs of the rationale for this mitzvah in action.)
This mitzvah applies in all times and places. It is discussed in the Talmud in the tractates of Nazir (59a) and Makkos (20b). It is codified in the Shulchan Aruch in Yoreh Deah 182. This mitzvah is #39 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #178 of the 194 negative mitzvos that can be observed today as listed in the Sefer HaMitzvos HaKatzar of the Chofetz Chaim.