Answer
Wa `alaykum As-Salamu waRahmatullahi wa Barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
If these holes in your trousers do not reveal the awrah, the prayer is valid while wearing them.
Answering your question, The Fatwa Center at Islamweb, states:
Prayer is what connects a Muslim with Allah five times a day. Prayer is what distinguishes a Muslim from a non-Muslim. A Muslim who performs the Prayer perfects his religion. A Muslim who does neglects Prayer is really neglecting his religion.
If these holes in your trousers do not reveal the awrah (what is between the navel and the knees for men) except after looking closely, as stated in your question, “Even I can only notice them when I closely look at them;” then the prayer is valid while wearing them.
However, there is another view that states that it is disliked to pray in such clothes and that it is desirable to repeat the prayer as long as its time has not elapsed.
We advise you not to pray in those trousers or the like of them in the future; rather, look for something else that does not reveal the awrah even when one looks closely at it.
Allah Almighty knows best.
Editor’s note: This fatwa is from Ask the Scholar’s archive and was originally published at an earlier date.