"No, but I would to save two brothers or eight cousins."
As you share on average half your alleles with a brother and one-eighth with a cousin, Haldane was giving the number of relatives one would have to save to "break even".
As quoted in Mathematical Models of Social Evolution : A Guide for the Perplexed (2007) by Richard McElreath and Robert Boyd, p. 82;
https://en.wikiquote.org/wiki/J._B._S._Haldane
This is in relation to the idea of kin selection: https://en.wikipedia.org/wiki/Kin_selection
There are instincts that become ingrained as part of evolutionary process, and they are those instincts that correlate with genes that propagate more.
Thus, the genes that you inherited from your parents may activate an instinct that will make you sacrifice yourself (or at least reduce your chances to reproduce in the future), so long as that results in a larger portion of those inherited genes in the gene pool down the line - e.g. because some of your siblings, or even more distant relatives, survived to carry them on.
It's one other reason why "survival of the fittest" is really a very misleading way to put it - it's about "survival" of a particular package of genetic traits, not about survival of the species, much less individual specimen.
Evolution is a game of information propagation, in which actual living beings are heavily parallelized delivery channels, information transmitted is the configuration of channels, and there's non-random noise (environment) affecting signal propagation through those channels. The "winning" configuration is likely to involve some channels that do not transmit data directly, but are dedicated to performing error correction etc for other channels, that do transmit information about the entire configuration.
In fact, over time, you may even end up with a configuration that can dynamically allocate channels for error correction, if and when the noise becomes noticeable enough (i.e. environment gets more hostile), so as to not waste valuable bandwidth when it's not necessary. And then we call such things "altruism", "heroic sacrifice" etc.
The principle behind this is that evolution operates at the level of genes, rather than individuals. I recommend Richard Dawkins' The Selfish Gene for a fuller explanation.