Buddhism, like all the world's major religions, values altruism as the greatest of qualities. The altruistic attitude can be developed and enhanced in every person. This is done by each person contemplating their own suffering, and then developing empathy for the similar sufferings that others experience.
A person who has developed a degree of altruism becomes compelled to act when they see the needs of others. If those needs are material, then material objects such as food or clothing are given. If the needs of others are to overcome fear and to be protected, then security and protection can be given. If the needs of others are to overcome their spiritual poverty, then guidance and instruction can be given.
In paricular in Buddhism the altruistic attitude leads to a recognition that as ordinary people we are extremely limited in our ability to help others in a complete way. This leads to the aspiration to develop fully one's own qualities and wisdom so as to be able to benefit others.
This results in the aspiration to achieve enlightenment oneself in order to be able to benefit others. Such a person recognizes that it is by having the qualities of an enlightened Buddha that one is best able to assist others.
So it is then by altruism that a person may actually withdraw from the world and engage in dedicated meditation retreat. Rather than being a selfish solitary action, this can be the best expression of concern for the welfare of others.