The ruling on wearing clothing on which there are kinds of images, writing and patterns is subject to further discussion.
If these images are of haraam things, such as pictures of women, crosses, symbols of nations that are hostile towards Muslims, or they are drawings of animate beings, or images of haraam things such as alcohol and cigarettes and the like, then it is haraam to wear them in the first place, and the prohibition on praying in them is even more emphatic. Because these images are haraam in and of themselves, it is not permissible to wear garments with them, according to the more correct of the scholarly opinions.
If these garments do not have any images, but they have some words and phrases that call to sin, such as the words “Kiss me” or “Follow me”, and so on, or similar words that are used by those who promote immorality, or words that promote corrupt beliefs, then it is also haraam to wear them outside of prayer, so wearing it when praying is even more forbidden. The reason for the prohibition is obvious, because it involves indecent words and is a visible evil; it is also a call to evildoing or kufr, and Allah says (interpretation of the meaning):
“O you who believe! Follow not the footsteps of Shaitân (Satan). And whosoever follows the footsteps of Shaitân (Satan), then, verily he commands Al-Fahshâ' [i.e. to commit indecency (illegal sexual intercourse)], and Al-Munkar [disbelief and polytheism (i.e. to do evil and wicked deeds; and to speak or to do what is forbidden in Islâm)]”
If the garments in which one is praying are free of images or haraam words, but they have decorations or shapes or other words, the ruling on them depends:
If they are things that catch the eye and one thinks it most likely that they will distract the worshippers who see them and make them think too much about them, then it is makrooh to pray in these garments, because it is proven that the Prophet (blessings and peace of Allah be upon him) forbade anything that will distract one when praying, as it says in the hadeeth of ‘Aa’ishah (may Allah be pleased with her):
The Prophet (blessings and peace of Allah be upon him) prayed in a garment that had markings, and he glanced at its markings. When he finished praying, he said: “Take this garment of mine to Abu Jahm, and bring me the plain garment of Abu Jahm, because it distracted me just now when I was praying.”
The hadeeth was narrated by al-Bukhaari in his Saheeh (373), where he included it under a chapter heading: If a person prays in a garment that has markings and looks at its markings. And it was narrated by Muslim in his Saheeh (556), where Imam al-Nawawi gave it the title: Chapter: It is makrooh to pray in a garment with markings.
Al-‘Allaamah Ibn Daqeeq al-‘Eed (may Allah have mercy on him) said:
From this report the fuqaha’ deduced that anything that may distract one from praying of colours, decorations and artifacts is makrooh. The ruling is general in application because the reason for it is general, and the reason is distraction during prayer.
End quote from Ihkaam al-Ahkaam, p. 219
Al-Qurtubi (may Allah have mercy on him) said:
In this hadeeth we see that there are some reservations about everything that could distract one in prayer by looking at it.
End quote from al-Mufhim lima Ashkala min Talkhees Muslim, 2/163
Ibn Qudaamah (may Allah have mercy on him) said:
Everything that may distract the worshipper from his prayer is makrooh… If the Prophet (blessings and peace of Allah be upon him) – despite the infallibility and focus in worship that Allah bestowed upon him – was distracted by that, then it is more likely in the case of other people.
End quote from al-Mughni, 2/72
Al-Bahooti al-Hanbali (may Allah have mercy on him) said:
It is makrooh to face that which will distract him because it will keep him from praying properly.
End quote from Kashshaaf al-Qinaa‘, 1/307
See also the answer to question no. 90097
But if those decorations and words – so long as they are not haraam – are insignificant and the worshippers will not pay attention to them, or if there are things that people usually have on their clothes in such a way that they will not distract the one who looks at them, then it is not makrooh to pray in them because the reason for it being makrooh is not present in this case.
I asked Ishaaq about praying on a cloth – What do you think about praying on a cloth with green markings and stripes?
He said: It is permissible.
End quote from Fath al-Baari by Ibn Rajab, 2/206
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
If we assume that the imam will not be distracted by that because he is blind or because this is something that he has seen many times, to the extent that he does not care about it or pay any attention to it, then we think that there is nothing wrong with him praying on it.
End quote from Majmoo‘ Fataawa al-Shaykh Ibn ‘Uthaymeen, 12/362
To sum up: if the shirt asked about includes writing that is not haraam but it attracts attention and distracts the worshippers who look at it, then it is makrooh to pray in it in that case, otherwise it is not makrooh.
But if the writing carries haraam meanings, it is not permissible to wear it at all, whether outside the prayer or when praying.
And Allah knows best.