17 USC 101 says:
“Publication” is the distribution of copies or phonorecords of a work to the public by sale or other transfer of ownership, or by rental, lease, or lending. The offering to distribute copies or phonorecords to a group of persons for purposes of further distribution, public performance, or public display, constitutes publication. A public performance or display of a work does not of itself constitute publication.
Note that the key element is distribution or offering to the general public. It has been held that distibution to only a small, selected group of people does not constitute publication in copyright law.
Prior to the 1976 Copyright Act, publication was a vital concept, because Federal copyright protection applied only after publication, and most copyright terms were measured from the year of publication. Publication without a copyright notice was usually fatal to US copyright protection.
Since the 1976 law became effective (in 1978), the concept of publication is much less vital, but can still be important in copyright law. Copyrights of works made for hire or other works with corporate authors are calculated from the date of publication, not by the life of the author. Registration is effective to preserve the right to statutory damages if it occurs within three months of first publication. While fair use can apply to unpublished works, courts are generally less willing to apply it than they would be for published works. Publication may be significant in other aspects of copyright law as well.
In the context of defamation "published" simply means "communicated to a third person" The communication need not be to the public at large.
The LII page on Defamation defines "publication" as
communication of [the defamatory] statement to a third person
Nolo's page on "Defamation Law Made Simple" says:
"Published" means that a third party heard or saw the statement -- that is, someone other than the person who made the statement or the person the statement was about. "Published" doesn't necessarily mean that the statement was printed in a book -- it just needs to have been made public through social media, television, radio, speeches, gossip, or even loud conversation. Of course, it could also have been written in magazines, books, newspapers, leaflets, or on picket signs.
The page on "Publication and Libel Laws" by LegalMatch says:
Publication is the delivery or announcement of a defamatory statement to another person through any medium. With respect to libel, the defamatory statement must be communicated through a tangible medium ...
Generally, publication occurs once a single individual sees or hears the defamatory statement. However, America has a long history of protecting free speech. As a result, courts will sometimes require more action than just the act of seeing a defamatory statement in print to determine when publication occurs ...
The exact time of publication is very important in a libel case. Generally, the time of publication will have an effect on a libel case in two ways:
- Statute of Limitations – Depending on when the publication of a defamatory statement took place, that is when the period of limitations begins to run. Knowing the exact time of publication can be very important if a statute of limitations is at issue.
- Damages – The time of publication can have a large impact on the damages a defamed person can recover. Generally speaking, the earlier the date of publication, the more damages a person has suffered.
The Law Dictionary's page on "How Do You Prove a Defamation of Character Claim? says:
The interesting thing to note about publication is that it’s not in the modern context, where it’s been published. It just means that it was done in a way where other people heard, saw, read, or otherwise came across this harmful lie about you. IE: it was public in some way where a third party was exposed to the statement.
The key difference is between providing a work to the general public (copyright), and communicating a statement to any third party (defamation). In addition,. publication is an essential element of any defamation claim, but only sometimes a relevant fact in a copyright claim.
My understanding is that this will also be true in most common-law countries, and possibly in some civil-law countries as well. But I cannot support that with sources.