He uttered the word of divorce (talaaq) whilst explaining the rulings on divorce and its wording to his wife
If you were speaking by way of explanation and giving examples, and you had no intention of divorce, then no divorce has occurred, because the Prophet (blessings and peace of Allah be upon him) said: “Deeds are but by intentions and each man will have but that which he intended.” Narrated by al-Bukhaari (1) and Muslim (1907) from ‘Umar ibn al-Khattaab (may Allah be pleased with him).
Hence the wife of a teacher or faqeeh who says, when explaining and discussing issues of divorce, “My wife is divorced”, is not actually divorced. The same applies in the case of one who utters the word of divorce without meaning to (a slip of the tongue).
Zakariya al-Ansaari (may Allah have mercy on him) said: The third condition (of divorce being valid) is the intention of divorce. So it is stipulated that he should intend to utter the words and intend the meaning of the words, both together, so as to break the bond of marriage… Because what matters is intention to say the word and intention of the meaning thereof, both together. The reason why there is a second condition for divorce to take place, namely intending to divorce one’s wife, is so as to exclude other scenarios such as when narrating that someone else divorced his wife, or when a faqeeh is explaining how divorce takes place, or calling by name a woman who is called Taaliq (which means divorced).
End quote from Asna’l-Mataalib, 3/280
What is meant by calling by name a woman who is called Taaliq is saying, Yaa Taaliq (O Taaliq)
In Sharh Manhaj at-Tullaab ma‘a Futoohaat al-Wahhaab (4/336) it says:
The condition is that he should intend divorce and intend to utter the word talaaq for what it means, in the sense that he intended to use the word for that purpose. For example, divorce does not take place on the part of one who asks some people for something but they do not give it to him, so he says: “I divorce you all,” and his wife happens to be among them but he did not realise that. Nor does divorce take place on the part of one who is telling how someone else divorced his wife, such as if he says “So and so said, ‘My wife is divorced.’” End quote.
And Allah knows best.