Naafil prayers at times when prayer is not allowed
Based on this, it is permissible to prostrate when reading one of the Qur’aanic verses where prostration is required at times when prayer is not allowed, according to the more correct of the two scholarly views, because that does not come under the same rulings as prayer. Even if we assume that it does come under the same rulings as prayer, it is permissible to do it at times when prayer is otherwise not allowed because it is something that is done for a reason, like the eclipse prayer, and the two rak’ahs following tawaaf if one has done tawaaf at a time when prayer is not allowed.
Fataawa al-Lajnah al-Daa’imah, 7/264.
Your saying, “the two rak'ahs for seeking forgiveness”; perhaps what you mean is the two rak’ahs of repentance, which are prescribed when repenting from sin. It was narrated that Abu Bakrah (may Allaah be pleased with him) said: I heard the Messenger of Allaah (peace and blessings of Allaah be upon him) say: “There is no man who commits a sin then he gets up, purifies himself and prays two rak’ahs, then asks Allaah to forgive him, but Allaah will forgive him.” Then he recited this verse (interpretation of the meaning):
“And those who, when they have committed Faahishah (illegal sexual intercourse) or wronged themselves with evil, remember Allaah and ask forgiveness for their sins; — and none can forgive sins but Allaah — and do not persist in what (wrong) they have done, while they know”
[Aal ‘Imraan 3:135]
Narrated by al-Tirmidhi, 408; Abu Dawood, 1521; Ibn Maajah, 1395. Classed as saheeh by al-Albaani in Saheeh Abi Dawood, 1346.
The two rak’ahs of repentance constitute a prayer for which there is a reason, so it is permissible to do that at a time when prayer is otherwise not allowed. And Allaah knows best.
In other saheeh reports there are other descriptions of the two rak’ahs which expiate for sin. This may be summed up as follows:
-There is no one who does wudoo’ and does it well (because sins come out from the washed limbs with the water or with the last drop of water)
Part of doing wudoo’ well is to say Bismillaah (In the name of Allaah) before starting it, and reciting dhikr after it, as follows: Ashhadu an laa ilaaha ill-Allaah wahdahu laa shareeka lah, wa ashhadu anna Muhammadan ‘abduhu wa rasooluhu. Allaahumma aj’alni min al-tawwaabeena waj’alni min al-mutatahhareen. Subhaanaka Allaahumma wa bi hamdika, ashhadu an laa ilaaha illa anta, astaghfiruka wa atoobu ilayk (I bear witness that there is no god but Allaah alone, with no partner or associate, and I bear witness that Muhammad is His slave and Messenger. O Allaah, make me one of those who repent and make me one of the purified. Glory and praise be to You, O Allaah, I bear witness that there is no god but You, I seek Your forgiveness and I repent to You). This dhikr recited after wudoo’ brings a great reward.
-Then he gets up and prays two rak’ahs
-In which he does not make any mistake
-And does not let his mind wander
-And he remembers Allaah and focuses with proper humility
-Then he asks Allaah to forgive him
The outcome will be: that he is forgiven for his previous sins and will deserve Paradise.
Saheeh al-Targheeb, 1/210-211.