Al-Imam Bin Baz, rahimahullah was asked the following question :

ما حكم لباس سروال ( البنطلون ) ؟ خاصة إن بعض من يلبسه ينكشف جزء من عورته ، وذلك وقت ركوعه وسجوده في الصلاة ؟

Question: What is the ruling on pants (pantaloon) especially being that some who wear it, a part from their awrah becomes apparent during them doing ruko and sujood in the prayer?

فأجاب رحمه الله  :

إذا كان البنطلون – وهو : السراويل- ساترا ما بين السرة والركبة للرجل ، واسعا غير ضيق صحت فيه الصلاة ،

Answer:

If the pantaloon is the pants which covers for the man what is between the navel and the knees, while it is wide and not tight, his prayer is then valid

والأفضل أن يكون فوقه قميص يستر ما بين السرة والركبة ، وينـزل عن ذلك إلى نصف الساق أو إلى الكعب؛ لأن ذلك أكمل في الستر .

What is better is that there be above it a thowb that covers what is between the navel and the knees and it goes down to his shin or to his ankles because that is more complete in covering himself

والصلاة في الإزار الساتر أفضل من الصلاة في السراويل إذا لم يكن فوقها قميص ساتر؛ لأن الإزار أكمل في الستر من السراويل . اهـ .

Praying in a izar (i.e. a lower garment) that covers the body is better then praying in just pants if there is no thowb above it that covers the body. (This is) because the izar is more complete in covering the body than the pants”

A Side Note: One should try according to his capability to make his work pants or school pants baggy or wide if possible or to wear a pakistani qamees (shirt) over it, although wearing the thowb should be his first choice inshaa Allah.

May Allah make our affairs easy for us all.

~ Abu Fajr AbdulFattaah bin Uthman