Differing views have been held about this. It has, at times, been the subject of a great deal of controversy, perhaps most prominently concerning the marital arrangements of Henry VIII in the 16th century. It was debated almost every year in the UK Parliament for much of the 19th century.
It was not allowed in the Church of England, or in the UK generally, until 1921. There was a prohibition against it in the Roman Catholic Church until the 1983 Code of Canon Law came out, although a dispensation could be obtained. At one time a dispensation could come only from the pope, but later from the local bishop.
An equivalent way of expressing this is that it was not, in fact, prohibited in the Roman Catholic Church at all: it simply required a different level of authorisation.
The question of whether a man may marry his brother's widow is dealt with in the Old Testament, both in Leviticus and Deuteronomy. There is an apparent contradiction.
In Leviticus chapter 18 verse 6 forbids sexual relations with close relatives. The following verses list various relatives such as mother, daughter, sister, aunt and, in verse 16, brother's wife.
So, according to Leviticus, a man may not marry his brother's widow.
One objection to this conclusion is to wonder whether it applies only while the brother is still living. However, as adultery is already forbidden, there would be no need to specify a list of relatives unless this applied after the marriage was ended (i.e. in this case the brother had died). The verse has been widely thought to apply to one's brother's widow. A man may not marry his brother's widow; just as he must not have sex with his mother. He must not marry his mother even after his father's death. He must not marry his sister-in-law even after his brother's death. His sister-in-law and his mother are perfectly free to re-marry after the deaths of their husbands, but just not to him.
Against this however, there is "Levirate" marriage. This is in Deuteronomy 25:5.
If brethren dwell together, and one of them die, and have no child, the wife of the dead shall not marry without unto a stranger: her husband's brother shall go in unto her, and take her to him to wife, and perform the duty of an husband's brother unto her. And it shall be, that the firstborn which she beareth shall succeed in the name of his brother which is dead, that his name be not put out of Israel.
This, then, appears to contradict Leviticus and say expressly that a man ought, in certain circumstances, to marry his brother's widow.
How can these be reconciled?
Perhaps the most common way was to take Deuteronomy as expressing a general rule, and Leviticus an exception. Others, including Calvin, interpreted the word "brother" in Leviticus as meaning a kinsman but not actually a brother. In this way a widow may not marry her husband's brother, but some other kinsman. This is supported from Ruth who, before marrying Boas, had to allow a nearer kinsman "first refusal". This, however, could be said to reflect Jewish custom rather than divine law.
Catherine of Aragon, daughter of the King of Spain, was first married to Prince Arthur, elder son of King Henry VII. Arthur died. Some, including Catherine herself, said the marriage was never consumated. Arthur was not well, it is said, or not mature.
From a political perspective, it was diplomatically advantageous that the king of Spain's daughter become Queen of England, and if not as wife of king Arthur (as he would become) then as wife of his younger brother Prince Henry. When Henry VII died then Prince Henry became king as Henry VIII. Shortly afterwards he married his brother's widow.
This was recognised as problematical. It was against church law but the Pope granted a dispensation. Henry was allowed to marry Catherine, despite the rules in Leviticus and the canon law of the Church.
The Deuteronomy rule applied only to "brothers" living together, and Arthur and Henry had mostly been brought up apart. They were certainly not living together during the time of Prince Arthur and Catherine's marriage. As Prince and Princess of Wales they resided in Ludlow Castle. Anyway, it was not argued to permit Henry and Catherine to wed. They relied instead on a papal dispensation.
Some twenty years later, Catherine had had seven children but all died very young or were stillborn. Only one, a girl survived infancy. Before Henry VII came to the throne in 1485 there had been civil wars known as the Wars of the Roses. Henry VIII needed a male heir. The country needed a male heir, it was widely felt, otherwise civil war threatened again. Henry may or may not have been infatuated with Anne Boleyn, but the need for a male heir and Catherine's inability to provide one, were matters of the utmost importancand Henry was not alone in recognising something needed to be done.
Henry and his ministers gathered theological opinions from all over Europe as @ThomasLorenz points out. The main thrust of attack was whether Henry's marriage to Catherine had been unlawful, and therefore Henry was free to marry Ann Boleyn.
The arguments were complex. Were the provisions in Leviticus divine law, or did they apply only to the Jews? If they were divine law, did the Pope have authority to issue the dispensation that allowed Henry and Catherine to marry in the first place. Most said no. If they were merely ecclesiastical laws, even though framed on Leviticus, then many said yes.
It is also the case that Henry spent a lot of money to secure favourable opinions on his case from prominent theologians. Were these bribes? Or were they more akin to lawyers fees? Henry was asking people to do a lot of investigation into all aspects of the question and present the matter in the most favourable light. This is what governments ask lawyers to do today.
The opinions of the theologians were not "votes" but arguments in favour of various aspects of Henry's case. Ultimately the Pope was not persuaded and refused to annul Henry and Catherine's marriage. However, the Holy Roman Emperor Charles V, Catherine's nephew, was occupying Rome and th ePope was not in a strong position to support Henry even if he had been persuaded of the merits of the case.
Luther favoured Henry taking another wife, bigamously, as the lesser evil. Ultimately Henry took from Luther a different approach. He rejected Papal authority anyway and Archbishop Cranmer annulled the marriage between Henry and Catherine.
A further complication was whether Arthur ever consumated his marriage. If he did not, and Catherine said he did not, then no impediment ever existed to henry and Catherine marrying.
Bishop Fisher of Rochester believed there were arguments for and against the annullment. He was appointed to represent Catherine's interests at one time. Once the Pope had spoken definitively, Fisher felt that must be respected. There were arguments in Henry's favour and against him. It was, according to Fisher, the Pope's duty and responsibility to rule on all such matters.
Perhaps nobody imagined it would start a split that, almost half a millenium later, shows little sign of healing.