Is it necessary to keep one's shalwar (lower garment) above one's ankles all the time or only when offering prayers?
Please note that it is commonly believed that we must always keep the garments above the ankles. The practice is not supposed to be related only to the Prayer. Though the people generally tend to observe what they believe in while offering the Prayer and ignore it in routine.
In this regard there are two kinds of narratives ascribed to the Prophet (sws), A) the ones where he is reported to have condemned the ones who keep their garments hanging on earth as expressive of their pride, and B) the one which tell us that the Prophet (sws) did not stop some of his companions from doing so.
A careful study of all the narratives in this regard reveals that it was the show of pride that was being achieved through that practice in that society and which the Prophet (sws) actually condemned. For these qualities are condemned by the Qur'an itself and the universal moral principles.
Therefore where he thought that the person had not yet attained the purification of his soul and elements of conceit and pride might reflect from him doing so he stopped the person involved. This is because generally in that society it was a sign of pride and self conceit. The prophet (sws) did not forbid those who he was sure could not have the evil in mind nor would people think them to be exhibiting pride.
If in a society the practice is not connected with this evil we cannot say that it is undesirable because of the absence of the basic cause of prohibition.