Herod had sent men who had arrested John, tied him up, and put him in prison. Herod did that for Herodias, whom he had married. (She used to be his brother Philip’s wife.)
John spoke out against the ruler Herod because Herod had married his own sister-in-law, Herodias. He also spoke out against Herod for all the evil things he had done.
When brothers live together and one of them dies without having a son, his widow must not marry outside the family. Her husband’s brother must marry her and sleep with her. He must do his duty as her brother-in-law.