Whenever the Messenger of Allah ﷺ went out on the day of Eid, he would order that a spear be brought and planted in front of him, and he would pray facing it while the people stood behind him. He would do the same while traveling, and from this practice the rulers adopted it.
أن رسول الله ﷺ كان إذا خرج يوم العيد أمر بالحربة فتوضع بين يديه، فيصلي إليها، والناس وراءه، وكان يفعل ذلك في السفر، فمن ثم اتخذ الأمراء.
Bukhari related it in "the Book of Prayer" (464), and Muslim in "the Book of Prayer" (501), both from the hadith of Abdullah bin Numayr, who said, "Ubaydullah told us, from Nafi, from Ibn Umar," and he related it.