What are the historical and scriptural reasons why women are prohibited and/or discouraged from wearing pants in some churches? Note: I'm little surprised that this question had not been asked before.
I've noticed that some churches place more emphasis on the issue of modesty than others. In more exaggerated cases, some churches go to the extremes of highly discouraging or straight up prohibiting women from wearing pants (and even makeup and jewelry), favoring instead more modest types of dresses, such as skirts.
Two questions:

What is the historical origin of these modesty-related prohibitions?
What is the biblical basis?
In like manner also, that women adorn themselves in modest apparel, with shamefacedness and sobriety; not with broided hair, or gold, or pearls, or costly array; [1 Timothy 2:9 KJV]

Shortly before being martyred, executed by the Emperor Nero, Paul the apostle gives instructions to Timothy regarding order in the church and the conduct of congregations.
With regard to clothing, Paul enjoins that women should adorn themselves 'modestly' which has two meanings, firstly that of not drawing attention by 'costly array' and complicated hair arrangements, but also of modesty in regard to the fit of clothing.
The prophet Isaiah goes into considerable detail when he comments upon the 'daughters of Zion' and their conduct in regard to these matters (Isaiah 3:16 to 26) and comments, also, on the judgments that are about fall upon Jerusalem because of that contribution to a wider spectrum of behaviour, throughout Judah.
It is difficult to convey to those who are a lot younger than myself what a dramatic change has happened in the general arena of those professing the name of Christ over the past half dozen decades : the jettisoning of conduct that was, at one time, not questioned, but rather adhered to without complaint.
As a young boy brought up in the Highlands of Scotland where the influence of Presbyterian  Christianity was considerable, I saw the visible effect of many generations of the preaching and teaching of the gospel and of the adherence to Paul's words.
Men and women attending a place of Christian worship would - all - dress modestly. Makeup of any kind was just not used. Men wore jacket and trousers with shirt and tie. Women wore long skirts and their top clothing was buttoned up to the neck.
Every woman had long hair and every man had short hair. Women also wore a hat or a headscarf, in accordance with the apostle's words in 1 Corinthians 11:5.
Still, today, I know of many congregations in my own country, the United Kingdom, where such practice still prevails. It is considered essential conduct among those congregations.
I well remember a preacher in my youth, perhaps it was in the 1970s, encouraging modest Christian women to take no notice of one who had criticised a certain lady for wearing clothing which the onlooker called 'frumpy'.
The preacher's retort was to say, 'Leave her alone and let her 'frump' her way to glory'.
As a young, single male, growing up in a congregation, in my twenties (forty years ago) I can only say how much I appreciated ladies wearing modest attire. I always deemed it to be considerate and charitable of women not to put temptation in the way of young (and not so young) men.
The corollary would (I can only suppose) be true of men who also dress in such a way as not to draw undue attention to themselves.
If we 'believe in the Lord Jesus Christ' and 'love one another' (as Jesus enjoins us to do) then it should not be a difficult thing for us to consider others in regard to the way in which we dress ourselves.