38 And unto every kingdom is given a law; and unto every law there are certain bounds also and conditions.So, only those who abide by the conditions of the law of the kingdom can stay in that kingdom.
39 All beings who abide not in those conditions are not justified. (Doctrine and Covenants 88:38–39)
Each of the kingdoms of glory has its own law:
22 For he who is not able to abide the law of a celestial kingdom cannot abide a celestial glory.Doctrine and Covenants 76 details some of the laws because it lists those who will be in the telestial kingdom, that is those who do not abide by either a celestial or terrestrial law. Nothing specifically says that the list is limited to these, but these things are known to be included:
23 And he who cannot abide the law of a terrestrial kingdom cannot abide a terrestrial glory.
24 And he who cannot abide the law of a telestial kingdom cannot abide a telestial glory; therefore he is not meet for a kingdom of glory. Therefore he must abide a kingdom which is not a kingdom of glory. (Doctrine and Covenants 88:22–24)
These are they who are liars, and sorcerers, and adulterers, and whoremongers, and whosoever loves and makes a lie. (Doctrine and Covenants 76:103)A trip to the Webster's Dictionary from Joseph Smith's day shows that a whoremonger was "one who practices lewdness" which includes anything unchaste including adultery, fornication, prostitution, buggery, bawdiness, obscenity, concubines, debauchery, harlotry, immodesty, lechery, libertinism, lubricity, putanism, and sodomy.
Systems of law that permit such behavior are telestial systems. Terrestrial and celestial systems do not permit such behavior.