Can I pump for a friend?

Yes. Breast milk is indeed an amazing gift for a baby whose mother cannot provide it. But there are some issues that make this a very tricky topic! first, you must be absolutely certain you are hiv-free, obviously. Second, be aware that in this litigious society, your good deed could be turned against you should the child develop any infections or health issues, even if not your fault! just be careful!
No. It is not a good idea to give breast milk to someone else's baby. There are, however, some places which have breast milk banks which you can donate to. Donated breast milk is treated and used to feed premature babies. There are some infections which can be transmitted through breast milk.