Is there any Islamic basis for doing that?
I have heard it was an Ottoman tradition to give khutbah with swords in places they conquered. I don't know any evidence for that. You might have to ask in history.stackexchange.com– The ZJul 26, 2020 at 4:25
@TheZ But does the tradition have any Islamic teachings behind it or is it purely cultural? I have seen Imams holding a staff in other places.– Atif ButtJul 26, 2020 at 4:28
There certainly is a backup and Islamic evidence for this act. But in the given case one can't deny or exclude a political background. As the Hagia Sophia already has been turned to a mosque by the 'Othman's but Atatürk turned it into a museum.– Medi1Saif ♦Jul 26, 2020 at 11:59
According to the majority of the mahabs, leaning on either a staff, bow or sword in the Khutbah is sunnah and hence mustahab.
يسن أن يعتمد على قوس أو سيف أو عصا أو نحوها
The Sunnah is to lean on a bow or sword or staff or like that
The evidence in hadith includes:
شهدنا فيها الجمعة مع رسول الله صلى الله عليه وسلم فقام متوكئا على عصا أو قوس
We offered the Friday prayer along with the Messenger of Allah (ﷺ). He stood leaning on a staff or a bow.
According to the Hanafi madhab leaning on a sword is desirable in areas conquered by force.
يخطب الإمام بسيف في بلدة فتحت به كمكة وإلا لا كالمدينة
The Imam will deliever the sermon with a sword in a city conquered by it such as Mecca and otherwise not such as Medinah