In the interests of common decency and peaceful conduct...
Firstly, we need to keep in mind that the letters to Timothy were not intended as God-given commandments or teaching for the general congregation, but as personal letters from one church leader to another. The author also begins this particular instruction with οὐκ ἄνθρωπος (ouk epitrepo - 'I do not permit'), expressing what can be interpreted as his own personal strategy in response to what was probably a question about a particular situation.
In fact, much of the instruction to Timothy with regard to women is expressed as a personal opinion and subsequent approach backed by the author's own interpretation of scripture, rather than as a truth or command from God:
For Adam was formed first, then Eve; and Adam was not deceived, but
the woman was deceived and became a transgressor. Yet woman will be
saved through bearing children, if she continues in faith and love and
holiness, with modesty. (1 Timothy 2: 14-15)
The word in 1 Timothy 2:12 translated to 'silence' is hésuchia (ἡσυχία) - which more accurately means 'stillness', not speechlessness or silence. While Paul's church communities appeared to recognise a woman as a person in her own right, the line was drawn at permitting her to express that autonomy in a way that offended the public sense of common decency. This meant that she was expected to behave in a calm and quiet manner at all times - to be a passive participant in the church, quiet in mannerism, not permitted to teach or to lead men, but not necessarily silent in speech.
This advice to Timothy (based on the author's personal opinions and interpretation of scripture) is an attempt to 'keep the peace' within the church. This is apparent as the paragraph begins with the author's intentions: to prevent anger or quarrelling in church:
I desire then that in every place the men should pray, lifting holy
hands without anger or quarreling; (1 Timothy 2:8)
The author follows immediately by advising specific behaviour expectations for women that can be easily enforced to reduce instances of anger or quarrelling in church:
also that women should adorn themselves modestly and sensibly in
seemly apparel, not with braided hair or gold or pearls or costly
attire but by good deeds, as befits women who profess religion. Let a
woman learn in silence [stillness] with all submissiveness. I permit
no woman to teach or to have authority over men; she is to keep
silent [to be in stillness]. (1 Timothy 2: 9-12)
Women at the time this letter was written were considered an extension of man - either a product of their father or a possession of their husband. This was in keeping with a limited knowledge of biology and the apparent origin of women as described in Genesis: as created from man's own flesh. The Old Testament often portrays the wife as an extension or voice of her husband's flesh - acting or speaking in conflict with his spirit. So, to allow a woman to speak up in church would be to give free rein to your own (sinful) flesh in public.
While these new Christian communities strove to emulate Jesus in promoting a certain level of equality and recognising women as individuals, the freedom this recognition afforded them to speak on their own merits - even have a mind of their own - may have come across as disorderly or even indecent or offensive by society's standards at the time.
This same interest in 'common decency' is expressed in the first letter to the Corinthians:
all things should be done decently and in order. (1 Corinthians 14:40)
'Decency' refers to appearance or behaviour that is considered acceptable by society. When Paul talks here about prophesying and speaking tongues in the church, he is reminding the community to behave within the church in a way that common society (of his time) considers to be 'decent'. This includes speaking or listening in turn, having someone available to interpret when one speaks in tongues, and women remaining silent in church.
Likewise, anyone gifted from the Spirit with speaking in tongues or with prophesy would have been overly eager to show it off at any opportunity. This chapter paints a picture of church gatherings as full of noise and confusion, with everyone trying to speak at once - many in tongues.
Paul's instructions here are an attempt to restore the appearance of order and decency to the church in Corinth. He calls on them to not be 'children in your thinking', and reminds them that their purpose in speaking up is to edify the church, not themselves. Otherwise they should be silent, and listen to others, giving each other a chance to speak. He then follows immediately with instructions to particularly restrict the behaviour of women:
As in all the churches of the saints, the women should keep silence
in the churches. For they are not permitted to speak, but should be
subordinate, as even the law says. If there is anything they desire to
know, let them ask their husbands at home. For it is shameful for a
woman to speak in church. (1 Corinthians 14: 33-35)
The word translated here as 'keep silence' is sigaó (σιγάω). This word comes from sigé (σιγή), meaning 'hush, silence', and specifically refers to no sound.
Conclusion
The letter to Timothy advises a demeanour of stillness, while the letter to Corinthians expressly forbids speaking in church, and demands silence.
However, both verses follow immediately from an expressed intention to control instances of general disorder in the church, whether anger and quarrelling (1 Timothy 2) or speaking out of turn (1 Corinthians 14).
Where the author says 'I desire' certain behaviour from men, he then says 'I do not permit' certain behaviour from women. The difference is in the locus of control - the men were not under his authority, so he could only instruct them in their behaviour. It was accepted in society at the time, however, that women were under the authority of either their husband or father and brothers, so their behaviour could easily be pulled into line by restricting what they were 'permitted' to do.
The intention was not to advocate the oppression of women - they were already oppressed. The intention was simply to restore order to the church.