Suppose you see a beautiful woman on the road and you and to marry her. But she is a kaafir. Therefore marriage is not allowed. My question is: Is it allowed to ask Allah to guide her to Islam and then marry her later?.
Before answering the question, we should say that the Muslim is enjoined to lower his gaze and avoid looking at that which Allaah has forbidden. Allaah says (interpretation of the meaning):
“Tell the believing men to lower their gaze (from looking at forbidden things), and protect their private parts (from illegal sexual acts). That is purer for them. Verily, Allaah is All‑Aware of what they do”
There is great divine wisdom behind this injunction, for Allaah is Most Merciful and Kind towards His slaves, so His laws relieve them of hardship and difficulty and the causes of mental and physical torment. It is well known that the eye is the messenger of the heart , so if he allows himself to look at beautiful images, his heart will become attached to these images, and these images will reside in his heart, then in most cases he will not be able to get what he wants so he will feel anguish.
Therefore Islam blocks the way to this suffering, by enjoining us to lower the gaze. So the Muslim has to follow this command in order to please his Lord and for his own peace of mind.
What you have referred to in your question is correct – that if a person likes something and desires it, then he has to prevent himself from attaining it in any way but that which Allaah has permitted, and he should make his desires in accordance with what the Messenger of Allaah (S) brought. This is the characteristic of the believer.
With regard to your question, the answer is that it is permissible to pray for a kaafir to be guided as is indicated in the saheeh ahaadeeth. It is proven that the Prophet (peace and blessings of Allaah be upon him) prayed for the tribe of Daws to be guided, and he said: “O Allaah, guide Daws.” Narrated by al-Bukhaari (2937) and Muslim 92524).
Al-Tirmidhi (5/82) narrated that Abu Moosa (may Allaah be pleased with him) said: The Jews used to sneeze in the presence of the Messenger of Allaah (peace and blessings of Allaah be upon him), hoping that he would say “May Allaah have mercy on you” to them. But he said: “May Allaah guide you and set your affairs straight.” Classed as saheeh by al-Albaani in Saheeh al-Tirmidhi.
Al-Haafiz Ibn Hajar al-‘Asqallaani (may Allaah have mercy on him) said in Fath al-Baari (10/604): The hadeeth of Abu Moosa indicates that they are included in the general command to pray for one who sneezes, but there is a special prayer for them, which is praying that they be guided and their affairs set straight, and there is nothing wrong with praying for them in that manner. End quote.
The great scholar Ibn Muflih al-Hanbali (may Allaah have mercy on him) said in al-Adaab al-Shar’iyyah (1/368), speaking about what is and is not permissible to say when praying for a kaafir: As for praying for him to be guided and so on, this is clearly permissible. End quote.
The one who prays for him should have a good intention when saying this du’aa’, which is to attain the pleasure of Allaah by bringing this woman to Islam and saving her from the punishment of Allaah, and other such good intentions. There is nothing wrong with also intending to marry her.
And Allaah knows best.