Whenever the Messenger of Allah ﷺ went out on the day of Eid, he would order a spear to be brought and placed in front of him. He would then pray facing it, with the people praying behind him. He used to do this while traveling, and from that practice the rulers adopted it.
حدثنا إسحاق يعني ابن منصور قال حدثنا عبد الله بن نمير قال حدثنا عبيد الله بن عمر عن نافع
أن رسول الله ﷺ كان إذا خرج يوم العيد أمر بالحربة فتوضع بين يديه فيصلي إليها والناس وراءه وكان يفعل ذلك في السفر فمن ثم اتخذها الأمراء