It is narrated from Sayyiduna Anas (may Allah be pleased with him) that he said: "The Messenger of Allah (peace and blessings be upon him) never took off his shoes during the prayer except once; (on that occasion) he (peace and blessings be upon him) took them off, and (seeing him) the people also took off their shoes. He (peace and blessings be upon him) asked: 'Why did you take them off?' They said: 'You took yours off, so we took ours off too.' He (peace and blessings be upon him) said: 'Indeed, Jibril (peace and blessings be upon him) informed me that there was filth on them.'"
Muhammad bin Abdullah al-Hadrami (may Allah have mercy on him) narrated it from Ibrahim bin Hajjaj (may Allah have mercy on him) like the narration of Abu Ya'la (may Allah have mercy on him).