To commend an opinion to those who already accept it.
'Preaching to the choir' (also sometimes spelled quire) is of US origin. It clearly refers to the pointlessness of a preacher attempting to convert those who, by their presence in church, have already demonstrated their faith. The first reference we can find is from 1973. Many other references date from soon after that, which points to the phrase being coined in that year; for example, this from The Lima News, Ohio, January 1973:
"He said he felt like the minister who was preaching to the choir. That is, to the people who always come to church, but not the ones who need it most."
The phrase may not be old but it does express the same idea as an earlier phrase - 'preaching to the converted', and is almost certainly a follow-on from that. This dates back around a century further and is first cited in the works of John Stuart Mill. He used the phrase in, An Examination of Sir W. Hamilton's Philosophy, 1867:
"Dr. M'Cosh is preaching not only to a person already converted, but to an actual missionary of the same doctrine."
The idea has also been expressed in another phrase that refers to an unnecessary act, that is, 'kicking at an open door'.
George Edward Bateman Saintsbury, in The Peace of Augustans, 1916, used both terms in one sentence:
"One may be said to be preaching to the converted and kicking at open doors in praising the four great novelists of the eighteenth century."