The Prophet (saw) did not compose poetry, but he recited some separate stanzas composed by other companions. But this does not make him a poet.
There were times when the Prophet (saw) recited poetry written by others but he was not a poet.
During the digging of the trench in the Battle of Khandaq, he recited a poem written by Abdullah ibn Rawaha (ra):
O Allah, were it not for you,
We would not have been guided,
Nor would we have given charity, nor prayed.
So bestow on us calmness... [Bukhari]
Ibn Katheer says he didn't memorize a single complete stanza of poetry on its exact meter and whenever he recited something, he would either not complete the stanza, or transpose some of the words.
Abu Sa'ud comments on occasion when the Prophet (saw) did seem to recite a new couplet, he was simply speaking without intending to rhyme and the words only seemed like poetry.
Background
We can break up this question into several pieces for us to have a full picture of such a topic. We need first to know what is poetry and whether the Prophet (saw) composed it or not.
What is Shi'r (Poetry)?
Imam Ibn al-Qtta', the best leading linguist of the fifth century, said there are three conditions for any statement to be called Arabic Shi'r (poetry):
So before labelling any speech, we must see that meet the conditions of Wazn, Qafiyah and intention of organizing the poetry, other than this would nor be called Shi'r ever.
Ibn al-Qatta' argues:
إِنْ خَلَا مِنْ هَذِهِ الْأَوْصَافِ أَوْ بَعْضِهَا لَمْ يَكُنْ شِعْرًا، وَلَا يَكُونُ قَائِلُهُ شَاعِرًا.
"If a given text does not fulfil all these conditions or some of them, it would not be Shi'r and its author is not a Sha'ir (poet)." (Ibn al-Qatta'm al-Shafi fi ]Ilm al-Qawafi)
I could add to these conditions that it must contain more than one stanza. The eight-century scholar ibn Hajar said:
إنَّ وُقُوعَ البَيتِ الوَاحِدِ مِنَ الفَصِيحِ لَا يُسَمَى شِعْرًا ، وَلَا يُسَمَى قَائِلُهُ شَاعِرًا .
"The utterance of a single stanza of a well-spoken (Arab) is not called poetry and its author is not called a poet." (Ibn Hajar, Fath al-Bari)
Did the Prophet compose Shi'r?
No, the Prophet (saw) did not compose such Shi'r, but he recited some poems composed by others. The Qur'an states:
وَمَا عَلَّمْنَاهُ الشِّعْرَ وَمَا يَنْبَغِي لَهُ
"And We did not give (Prophet Muhammad) knowledge of poetry, nor is it he can do it. It is not but a message and a clear Qur'an" (Qur'an 36:69)
It was narrated the Prophet said some statements that could meet the first two conditions. For example, when the Prophet's finger bled, he said:
هَلْ أَنْتِ إِلاَّ إِصْبَعٌ دَمِيتِ، وَفِي سَبِيلِ اللَّهِ مَا لَقِيتِ
"You are just a finger that bled, and what you got is in Allah's Cause." (Bukhari 2802)
This stanza was repeated by other companions such as Abdulah ibn Rawahah (ra) later when his finger got hurt in the battle of Mu'tah, but the Prophet (saw) is the first one to say it.
In another situation, when the companions were trying to flee from the battle of Hunayn, the Prophet (saw) shouted at them saying:
أَنَا النَّبِيُّ لاَ كَذِبْ أَنَا ابْنُ عَبْدِ الْمُطَّلِبْ
"I am the Prophet undoubtedly; I am the son of `Abdul Muttalib." (Bukhari 4316)
These two statements may fulfil the two conditions of the Arabic way of composing poetry (other scholars argue they are not), but they don't fulfil the rest two conditions to consider them as poetry; he did not intend composing poetry, but he, as an Arab, said similar statements that their ends are similar to what the poet compose; he only issued one stanza, not a whole poem or even a few stanzas.
This situation is obvious in Arab speaking people who are not poets could utter a statement and finally figure out it is similar to Arabic poetry.
Ibn al-Qatta' commented on these verses:
وَالنَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ لَمْ يَقْصِدْ بِكَلَامِهِ ذَلِكَ الشِّعْرَ وَلَا أَرَادَهُ فَلَا يُعَدُّ شِعْرًا وَإِنْ كَانَ مَوْزُونًا
"The Prophet did not intend nor willed by his speech to deliver Shi'r, so it is not considered as Shi'r even if it has Wazn." (Ibn al-Qatta'm al-Shafi fi ]Ilm al-Qawafi)
I myself, a none poet Arab, wrote once considering my fiancee when she naturally got sad for the death of a man:
ِأَغَارُ عَلَيْهَا مِنْ مَقْبُورٍ مُكَفَنِ، إِذَا مَرَّ ذِكْرُهُ عَلَى لِسَانِهَا بِالتَرَحُم
"I feel jealous of her seeking the Mercy of (a dead who is) enshrouded in his grave."
A scholar heard this and said, 'O you are a good poet and this is a high level of Shi'r.'
I replied, 'I have never seriously studied poetry nor composed a poem.'
He then asked me If I can add a few stanzas and I could not, so he told me I am not a poet and what you said does not belong to poetry, rather randomly similar. This is because my speech does not meet all the conditions for it to be called Shi'r.
Did the Prophet (saw) recite the poems composed by others?
Yes, he did. There were times when the Prophet (saw) recited poetry written by others such as during the digging of the trench in the Battle of Khandaq, he recited a poem written by Abdullah ibn Rawaha (ra):
لولاَ أَنْتَ مَا اهْتَدَيْنَا نَحْنُ، وَلاَ تَصَدَّقْنَا وَلاَ صَلَّيْنَا، فَأَنْزِلَنْ سَكِينَةً عَلَيْنَا
"O Allah without Your (interference), we would not be guided nor give charity nor pray. So descend tranquillity upon us." (Bukhari 7236)
Aisha (ra) also narrated the Prophet (saw) loved and used to recite the poems composed by Abdullah ibn Rawaha:
قِيلَ لَهَا هَلْ كَانَ النَّبِيُّ صلى الله عليه وسلم يَتَمَثَّلُ بِشَيْءٍ مِنَ الشِّعْرِ قَالَتْ كَانَ يَتَمَثَّلُ بِشِعْرِ ابْنِ رَوَاحَةَ وَيَتَمَثَّلُ وَيَقُولُ " وَيَأْتِيكَ بِالأَخْبَارِ مَنْ لَمْ تُزَوِّدِ
"Aishah was asked: "Did the Prophet (saw) used to say any poetry?"
She said: "He would say parables with the poetry of Ibn Rawahah, saying: 'News shall come to you from where you did not expect it. (Bukhari in al-Adab Al-Mufrad 867, Tirmidhi 2848)
But this does not make anyone a poet; similar to the one who memorizes some songs or Anasheed, but he is not a singer.
Conclusion
The Prophet (saw) did not compose poetry, but he recited some separate stanzas composed by other companions. But this does not make him a poet.
References
Ibn al-Qatta'm al-Shafi, Ilm al-Qawafi
Ibn Hajar, Fath al-Bari
Bukhari, al-Adab Al-Mufrad
Great answers start with great insights. Content becomes intriguing when it is voted up or down - ensuring the best answers are always at the top.
Questions are answered by people with a deep interest in the subject. People from around the world review questions, post answers and add comments.
Be part of and influence the most important global discussion that is defining our generation and generations to come