Tim Jankowiak writes the following about Kant's ethics:
Kant also argued that his ethical theory requires belief in free will, God, and the immortality of the soul. Although we cannot have knowledge of these things, reflection on the moral law leads to a justified belief in them, which amounts to a kind [of] rational faith.
Kant attempts to provide a rational foundation for duty (deontology) through the concepts of good will and categorical imperative. The emphasis on duty and will implies that consequences (consequentialism) such as happiness or pleasure are not what is important. Unlike a good will, which is an unconditional good, happiness is conditional:
Happiness is only good on the condition that the happiness is deserved.
With that preliminary consider Section 7 "Of Self-defilement" from the Elementology of Ethics. Of the Duties Owed by Man to Himself keeping in mind that pleasures derived from sexual activity are conditional: They need to be deserved to be considered good. Kant writes: (page 240)
As the love of life is bestowed upon us for the preservation of our person, so the love of sex for the continuance of our kind.
He asks if there is anything restricting us with the use of our reproductive abilities:
...a question arises, if the power of propagating one's species stands under a restrictive law; or if the person exercising such a faculty may, without subverting any duty by doing so, overlook that end of nature, and employ his intersexual organs as the mere engine of brute pleasure.
In looking for those restrictions, he rephrases that question in terms of duty owed to oneself: (page 241)
Whether there be or not a duty owed by man to himself, in respect of this appetite, the violation whereof ATTAINTS (not merely degrades), the humanity inhabiting the person. The appetite itself is called LUST, and the vice it gives birth to is called IMPURITY. The virtue, again, raised upon this instinct of the sensory is termed CHASTITY; and this CHASTITY is now to be represented as a duty owed by man to himself.
Chastity is a duty we owe ourselves. He then describes what an unnatural lust is so as to call self-defilement unnatural:
A lust is said to be unnatural, when a man is impelled to it, not by a real given matter objected to his sensory, but by the productive power of his imagination, depicting to him in fancy the object, contrary to the end aimed at by nature; and, in truth, an end yet more important than the end proposed by nature in the instinctive love of life....
He considers this unnatural use of one's body as a "violation" which is "manifest to everybody" because discussing suicide involves less shame. However, he admits it is difficult to provide a rational ground for rejecting self-defilement except for the following:
The ground of proving is to be sought, no doubt, in this, that man meanly abdicates his personality, when he attempts to employ himself as a bare means to satisfy a brutal lust.
However, this doesn't explain why people feel less shame toward self-murder than toward self-defilement, but he offers the following as a possible explanation: (page 242)
...perhaps, it might be urged that the headlong obstinacy of the suicide, who casts away life as a burden, is no effeminate surrender to sensitive excitement, but shows valour, and so leaves ground for reverencing the humanity he represents; while this other resigns himself an abandoned outcast to brutality, enjoying his own self-abuse - that is, he makes himself an object of abomination, and stands bereft of all reverence of any kind.
This answer does not address Kant's views on homosexuality and polygamy, but they are likely in line with the above. It only attempts to clarify how Kant views self-defilement as unnatural and why he discusses it in terms of suicide.
Immanuel Kant. Metaphysics of Ethics. Translated by J.W. Semple. (1871) Retrieved from Internet Archive at https://archive.org/details/TheMetaphysicOfEthicsByImmanuelKantTranslatedByJ.w.SempleEdited/page/n239
Tim Jankowiak. Immanuel Kant. Retrieved on September 30, 2019 from Internet Encyclopedia of Philosophy at https://www.iep.utm.edu/kantview/.