When the Messenger of Allah ﷺ would go out (for prayer) on the day of 'Id, he ordered to bring a lance, it was then setup in front of him and he would pray in its direction, and the people (stood) behind him. He used to do so during journey ; hence the rulers would take it (lance with them).
أَنَّ رَسُولَ اللَّهِ ﷺ كَانَ إِذَا خَرَجَ يَوْمَ الْعِيدِ أَمَرَ بِالْحَرْبَةِ فَتُوضَعَ بَيْنَ يَدَيْهِ فَيُصَلِّي إِلَيْهَا وَالنَّاسُ وَرَاءَهُ وَكَانَ يَفْعَلُ ذَلِكَ فِي السَّفَرِ فَمِنْ ثَمَّ اتَّخَذَهَا الأُمَرَاءُ