Narrated Abu Hurairah:
A man was praying with his lower garment hanging down. The Messenger of Allah ﷺ said to him: Go and perform ablution. He then went and performed ablution. He then came and he said: Go and perform ablution. Then a man said to him: Messenger of Allah, what is the matter with you that you commanded him to perform ablution and then you kept silence ? He replied: He was praying while hanging down his lower garments, and Allah does not accept the prayer of a man who hangs down his lower garment.
Sunan Abi Dawood, 4086 Sunan Abi Dawood, Vol. 4, Book of Clothing (Kitab Al-Libas), Hadith 4075 Sunan Abi Dawood, Book of Clothing (Kitab Al-Libas), Hadith 4075