It is narrated from Sayyiduna Abu Sa'id Khudri (may Allah be pleased with him) that the Messenger of Allah (peace and blessings of Allah be upon him) said: "When any one of you is praying, he should not let anyone pass in front of him. If the person insists, then stop him forcefully, for he is a devil."
Hadith Referenceسنن دارمي / من كتاب الصللاة / 1449
(Commentary on Hadith 1448) It is mentioned in the hadith «فَلْيُقَاتِلْهُ» that if he insists on passing, then fight him. From this hadith, it is understood that passing in front of someone who is praying is prohibited, and if the person insists, then he should be stopped firmly. The Messenger of Allah (sallallahu alayhi wa sallam) likened such a person to Satan, because Satan’s work is also to cast whispers (waswasah) and create disturbance in prayer, and the one passing in front of the praying person is doing the same thing, so it is as if he too is a Satan. This hadith proves that a person should remain close to the sutrah (barrier), because if he is not close, how will he be able to stop the one who tries to pass? And Allah knows best.