The story of Luqman is mentioned in Sura Luqman (31:12-19). More about Luqman is stated in Ibn Kathir’s book, “Stories of the Prophets”. A summary of that story is stated below.
Luqman Ibn ‘Anqa’ Ibn Sadun or, as stated by As-Suhaili from Ibn Jarir and Al-Qutaibi, Luqman Ibn Tharan, was from among the people of Aylah (Jerusalem). He was a pious man who exerted himself in worship and who was blessed with wisdom.
The Salaf differed over the identity of Luqman; there are two opinions: was he a Prophet or just a righteous servant of Allah without the prophethood The majority favored the latter view, that he was a righteous servant of Allah without being a Prophet. Sufyan Ath-Thawri said, narrating from Al-Ash`ath, from `Ikrimah, from Ibn `Abbas,
“Luqman was an Ethiopian slave who was a carpenter. `Abdullah bin Az-Zubayr said, “I said to Jabir bin `Abdullah: `What did you hear about Luqman’ He said: `He was short with a flat nose, and came from Nubia.”‘ Yahya bin Sa`id Al-Ansari narrated from Sa`id bin Al-Musayyib that “Luqman was from the black peoples of (southern) Egypt, and had thick lips.
Allah gave him wisdom but withheld prophethood from him.” Al-`Awza`i said, “`Abdur-Rahman bin Harmalah told me; `A black man came to Sa`id bin Al-Musayyib to ask him a question, and Sa`id bin Al-Musayyib said to him: “Do not be upset because you are black, for among the best of people were three who were black: Bilal, Mahja` the freed slave of `Umar bin Al-Khattab, and Luqman the Wise,
who was a black Nubian with thick lips.” Ibn Jarir recorded that Khalid Ar-Raba`i said: “Luqman was an Ethiopian slave who was a carpenter. His master said to him, `Slaughter this sheep for us,’ so he slaughtered it. His master said: `Bring the best two pieces from it,’ so he brought out the tongue and the heart. Then time passed, as much as Allah willed, and his master said:
Slaughter this sheep for us,’ so he slaughtered it. His master said, `Bring the worst two morsels from it,’ so he brought out the tongue and the heart. His master said to him, `I told you to bring out the best two pieces, and you brought these, then I told you to bring out the worst two pieces, and you brought these!’ Luqman said,
There is nothing better than these if they are good, and there is nothing worse than these if they are bad.”‘ Shu`bah narrated from Al-Hakam, from Mujahid, “Luqman was a righteous servant, but he was not a Prophet.” Allah’s saying: