At the time of the setting of Hamlet in Denmark, Denmark was a Roman Catholic country, and in that religion, a marriage of former brother-in-law to a former sister-in-law would have been considered incestuous. This type of relationship would have been on a list of opposed marriages. While it is never directly stated in the play, it is suggested in Claudius's first speech to the court that the courtiers to the king and queen have "freely gone with this affair along." Because they are not related by blood it isn't a completely abhorrent relationship, and Claudius and the court could make a good case that this marriage is actually going to help in the preservation of Denmark. They could claim that Gertrude is a beloved queen and the people would want her to continue as queen, even though the ruler of the throne is dead. They could claim that this marriage solidifies Claudius's reign because he clearly taking over ALL of the duties of the former king. If the queen wants this; then everyone should want this. Both the church and the state "went along with this affair" to please the king (who rules by divine right) and to ensure the continuity of the kingship.