Deuteronomy 22:5 says: "A woman shall not wear anything that pertains to a man, nor shall a man put on a woman's garment, for all who do so are an abomination to the Lord your God."
Like many of the statutes, this law may have been needed partly because of the pagan customs in the surrounding cultures. The Jamieson, Fausset and Brown Commentary explains:
"Disguises were assumed at certain times in pagan temples. Maimonides...mentions that a man attired in a coloured female dress, in honour of Venus, Ashtaroth, or Astarte, and a woman equipped in armour, worshipped at the shrine of the statue of Mars...
"Asiatics, when they engaged in the worship of Ashtaroth, were accustomed, according to Philocorus, quoted by Townley (in his edition of Maimonides, note 33), to exchange the male and female dresses. In fact, all idolators confounded the sexes of their deities—representing them sometimes as male, at other times as female; and hence, their worshippers, male and female, fell gradually into the custom, which became extensively prevalent, of changing their attire in adaptation to the sex of a particular divinity."
God's command to Israel forbade the people from incorporating pagan religious rites into true worship. In spite of this instruction, today's Christianity commonly mixes paganism in with the worship of Christ.
Does Deuteronomy 22:5 forbid women from wearing pants? No, it doesn't. In fact, clothing “that pertains to a man” at the time the verse was written would not have been understood to mean pants. Men in the Middle East through the history of the Old and New Testaments did not ordinarily wear pants, trousers or slacks; they wore robe-like garments. And in many cultures such as in China, women have commonly worn pants. The scripture more specifically addresses and forbids transvestism and cross-dressing.
The underlying principle certainly applies to today. Men should dress in an appropriately masculine manner and women should dress in an appropriately feminine manner. Clothing manufacturers make pants designed for men, and pants, slacks and pantsuits designed for women. The Bible emphasizes modesty, and for women, slacks are often more modest than a short skirt.
God does not intend for this scripture to be understood in an extreme or unreasonable way. For example, it’s perfectly fine for a woman to wear her husband’s old shirt when she’s painting or to put on her male friend’s jacket when she’s cold.