What advantage would the initial 'donor' in horizontal gene transfer by conjugation have received?
The donor bacterium, viewed as a unit, may well gain no advantage from sharing its genes.  The genes that are shared, however, may gain a very substantial reproductive advantage from being able to spread to other strains.  If some of the genes that are capable of being shared also promote sharing, they may be selected for by evolution.

This is a good example of the basic principle of the gene-centered view of evolution, famously popularized by Richard Dawkins is his book The Selfish Gene: evolution selects for genes that are good at spreading themselves.  This may, but need not always, imply helping the organism containing the gene to survive and reproduce.