عَنِ ابْنِ عُمَرَ رَضِيَ اللَّهُ عَنْهُمَا عَنِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ قَالَ مَنْ كَانَ حَالِفًا فَلَا يَحْلِفْ إِلَّا بِاللَّهِ عَزَّ وَجَلَّ وَكَانَتْ قُرَيْشٌ تَحْلِفُ بِآبَائِهَا فَقَالَ لَا تَحْلِفُوا بِآبَائِكُمْ
It is narrated from Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) said: Whoever wishes to swear an oath, should swear only by Allah Almighty. Since the Quraysh used to swear by their forefathers, the Prophet (peace and blessings be upon him) said to them: Do not swear by your forefathers.
Brief Explanation
Benefits: … The thing by which an oath is sworn is called "mahluf bih." In reality, by swearing an oath, veneration of the mahluf bih becomes necessary, whereas greatness is exclusive to Allah Ta'ala. Therefore, swearing an oath by other than Allah has been prohibited. As for the matter of Allah Ta'ala, He may swear by whichever of His creations He wills; His purpose in this is to indicate the honor of that thing.