From the Islamic viewpoint, sodomy is a very inferior and ugly act and is one of the great sins for which heavy punishments have been determined, namely execution. 
What various verses of the Quran tell us is that no matter how great and numerous one’s sins are, he shouldn’t lose hope in Allah’s mercy and forgiveness, because Allah Himself has vowed to forgive. 
Allah (swt) who is the creator of man and is aware of all his characteristics, has seen it possible for him to be purified of all sins (no matter how big) and has invited everyone to struggle and battle the desires to achieve that and has promised forgiveness in return, to the extent that He has introduced losing hope in His mercy and forgiveness as the highest and greatest of all sins. 
Therefore if one commits any sin and impurity, even such a sin as sodomy, but truly regrets it and repents, there is hope that God willing, he will be forgiven and subject to Allah’s mercy.
But certainly, not committing a sin is easier than repenting from it, because the true repentance has conditions that have their own difficulties and hardship, and not everyone may succeed in this regard. Also, if there are any inevitable effects for the sin, he will not be immune from them even in the case of true repentance.
One shouldn’t forget that the ugly act of sodomy has its own inevitable effects and implications (such as the impermissibility of ever getting married to the daughter or sister or mother of the person he has performed sodomy with) that aren't erased even if one truly repents from the sin.  Even if he has gotten married to any of them after this act unknowingly, the marriage is void and the two have to separate from each other.
 Tawdih al-Masa’el (annotated by Imam Khomeini), vol. 2, pg. 818.
 Zumar:53 “ قُلْ یا عِبادِیَ الَّذینَ أَسْرَفُوا عَلى أَنْفُسِهِمْ لا تَقْنَطُوا مِنْ رَحْمَةِ اللَّهِ إِنَّ اللَّهَ یَغْفِرُ الذُّنُوبَ جَمیعاً إِنَّهُ هُوَ الْغَفُورُ الرَّحیمُ ”.