There was polygamy, or plural wives, in the Old Testament.
Starting with the (NRSV) Bible.
In the Book of Mormon, the book of Jacob, Jacob explains to the Nephites how God sees plural wives. (Jacob 2:27-30)
27 Wherefore, my brethren, hear me, and hearken to the word of the Lord: For there shall not any man among you have save it be one wife; and concubines he shall have none;
28 For I, the Lord God, delight in the chastity of women. And whoredoms are an abomination before me; thus saith the Lord of Hosts.
29 Wherefore, this people shall keep my commandments, saith the Lord of Hosts, or cursed be the land for their sakes.
30 For if I will, saith the Lord of Hosts, raise up seed unto me, I will command my people; otherwise they shall hearken unto these things.
So God has to command plural marriage by revelation.
Unfortunately for Joseph Smith, God revealed that he wanted all things restored, including polygamy. This revelation was recorded 12 July 1843, and is known in the Doctrine and Covenants as revelation 132.
37 Abraham received concubines, and they bore him children; and it was accounted unto him for righteousness, because they were given unto him, and he abode in my law; as Isaac also and Jacob did none other things than that which they were commanded; and because they did none other things than that which they were commanded, they have entered into their exaltation, according to the promises, and sit upon thrones, and are not angels but are gods.
38 David also received many wives and concubines, and also Solomon and Moses my servants, as also many others of my servants, from the beginning of creation until this time; and in nothing did they sin save in those things which they received not of me.
39 David’s wives and concubines were given unto him of me, by the hand of Nathan, my servant, and others of the prophets who had the keys of this power; and in none of these things did he sin against me save in the case of Uriah and his wife; and, therefore he hath fallen from his exaltation, and received his portion; and he shall not inherit them out of the world, for I gave them unto another, saith the Lord.
40 I am the Lord thy God, and I gave unto thee, my servant Joseph, an appointment, and restore all things. Ask what ye will, and it shall be given unto you according to my word.
Poor Joseph. God commanded him to restore all things. He felt obliged to marry 34 other women.