Simply, it is reprehensible. She was wrong to do that. However, was your friend on his way out before finding out? If he is/was unhappy, he can still leave. As long as he is still a good father*, he doesn't have to be with the mother.
Is this a co-ed baby shower? Most are women only around here. We had a "Diaper Party" for all the guys to get together, cook out, have some beers, etc. That was nice.
Anyway, if it's not a co-ed baby shower - No Problem! You don't have to go or give anything.
If it is a co-ed baby shower, and your friend is happy with the mother - Go to support him. He's happy, you should be too.
If it is a co-ed baby shower, and your friend is unhappy or planning to leave the mother - Go to support or skip. I think people would understand either way, if they know the situation.
*Of course, some leave with no intention of being in the baby's life. I hope this isn't the case
Anything shy of making the gift a paternity test would be kind.
I like it.