He committed an immoral act during the day in Ramadan, and fears that if he fasts for two months he will be exposed and put to shame. What should he do?
Question

Unfortunately, I committed a major sin during the day in Ramadan, and I feel great anguish in my heart. I hope that Allah will accept my repentance. I know that the one who commits a homosexual act during the day in Ramadan is subject to the same consequences as a husband who has intercourse with his wife during the day in Ramadan, and that the requirement is to free a slave; and if that is not possible, then he must fast for two consecutive months; and if he is not able to do that, then he must feed sixty poor persons. I am unable to free a slave, and I have no health problems that would prevent me from fasting for two consecutive months. But I am afraid that someone around me would notice that, and I am not married, and I cannot explain to them why I am fasting for this period. I am afraid that they will become suspicious about me, especially my parents, and if they found out what I did, they will disown me. Will it be okay for me to feed sixty poor persons?
Praise be to Allah.Firstly:
What is required is for you to repent to Allah, may He be exalted, from this abhorrent evil deed, and to avoid the causes that led to it.
By doing this action, you have committed two major sins, namely deliberately breaking the fast during the day in Ramadan, and committing this evil immoral deed.
For more information on the warning addressed to the one who commits homosexual acts, please see the answer to question no. 27176 .
Ibn Khuzaymah (1986) and Ibn Hibban (7491) narrated that Abu Umamah al-Bahili said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: “Whilst I was sleeping, two men came to me and took hold of my upper arm, and brought me to a rugged mountain. They said: ‘Climb up.’ I said: ‘I cannot do it.’ They said: ‘We will make it easy for you.’ So I climbed up until I was at the top of the mountain. There I heard loud voices. I said: ‘What are these voices?’ They said: ‘This is the howling of the people of Hell.’ Then I was taken and I saw people suspended by their ankles, with the corners of their mouths torn and pouring with blood. I said: ‘Who are these?’ They said: ‘These are the people who broke their fast before it was time to do so.’” Classed as sahih by al-Albani in Sahih Mawarid az-Zam‘an (1509). 
So you should strive hard in repentance, seeking forgiveness and regretting what you did, and you should do a lot of righteous deeds, in the hope that Allah will pardon you.
Allah, may He be exalted, said (interpretation of the meaning):
{But indeed, I am the Perpetual Forgiver of whoever repents and believes and does righteousness and then continues in guidance} [Ta-Ha 20:82].
Secondly:
If the fasting person commits a homosexual act during the day in Ramadan, he must offer the heaviest expiation, like the one who has intercourse with his wife during the day in Ramadan.
This view is the correct view, and it is the view of the majority of scholars.
An-Nawawi said in al-Majmu‘ (6/377):
Scholarly views regarding one who has intercourse with a woman or with a man in the back passage:
We have stated above that our view is that it is obligatory to make up the fast and offer expiation. This is also the view of Malik, Abu Yusuf, Muhammad and Ahmad.
Abu Hanifah said: He must make up the fast.
Regarding the obligation to offer expiation, two views have been narrated from him, the more famous of which is that no expiation is required, because it is not proper intercourse and it is more akin to being intimate [with one’s wife] without penetration in the vagina.
Our companions argued that it is intercourse, and it is a more grievous sin because of the fast, therein expiation is required in this case. End quote.
The basic principle is that expiation must be offered immediately, but if the matter is as you mentioned, that you are afraid of being exposed to shame before your family, then we think that you may delay offering expiation until it becomes easier for you to do it, such as if you travel and the like, so that you will be able to fast.
But if you do not think that you will have the opportunity to travel soon, and you want to hasten to absolve yourself of responsibility, then you can make a vow (nadhr) to offer the expiatory fasts that are required of you, or you can vow to fast for two consecutive months as an expiation for what you have done, so that if any of your family notices that, and you are afraid of being exposed to shame, you can tell them that you vowed to fast for two consecutive months.
We ask Allah to accept your sincere repentance and to bring you back to the right path, and to protect you from slipping and going astray.
And Allah knows best.