Social Darwinism was the idea that human societies function in much the same way that nature does. That is, Darwinistic processes of natural selection occur in society just as in nature. In human society, as in nature, only the “fittest” survive.
This idea had at least two distinct sides to it. First, it explained why some people prospered and other people did not. The poor, clearly, were less “fit” than the rich. Second, it applied to whole countries, warning that a country that was not sufficiently “fit” might lose its place in the world and be swallowed up or at least dominated by countries that were more fit.
These ideas, particularly the second one, led to eugenics of both sorts. If you need your country to be made up of strong and fit people, it clearly makes sense (in this way of thinking) to rid yourself of the weakest and least fit in society. Negative eugenics prevented such people from reproducing. If you need your country to be made up of the fittest people, it makes sense to encourage the best people to reproduce more and to make sure that they were reproducing with other of the fittest people in society.
Thus, the desire to improve the fitness of the overall society led to the ideas of positive and negative eugenics.