When doing a penalty shootout, is it possible for the opposing team's goalkeeper to take a kick? I've never seen it happen, but it seems that since the goalie is part of the team, he/she should be able to take a kick.
Bonus: Has this ever happened?
Yes, they can.
Example: During the 2012 UEFA Champions League final, Manuel Neuer of Bayern Munich took a penalty against Chelsea, when the game went into penalties.
Please refer this wikipedia link.
Also, when a game is being decided by penalties, then all players must have taken one penalty each, before a player can take a second penalty. So, a goal keeper would have to take a penalty, before any other player gets a second chance.
The accepted answer is great but I might add that in kicks from the penalty mark to decide a winner, all eligible players need to have taken a kick before a player may take a second kick.
This means that the goalkeeper not only can take a kick, but must take a kick before any of the other players take a second kick.
Of course it's legal and has happened many times other than the accepted answer's example. E.g José Luis Chilavert used to take penalties that were not even in penalty shoot-outs, as well as free kicks. See: Jose Luis Chilavert's international goals (YouTube).
An better example than Manuel Neuer would be Jörg Butt:
"Known for taking penalty kicks, he scored 26 goals in the Bundesliga."
Yes, it is legal - and as someone already claimed, even required if all other players have taken theirs.
To give some examples: Manuel Neuer converted a penalty for Bayern Munich against Real Madrid (?) in the Champions League quite recently. There are also goalkeepers who take penalties during the game, such as Hans-Jörg Butt, who converted a penalty for Bayern in CL against Juventus. Bonus trivia: the score was 1-0 to Juventus before the penalty, which made it 1-1. Bayern went on to win 4-1.
This happened late last year in the Women's NCAA College Cup game between Rutgers University and the University of Virginia. Casey Murphy of Rutgers who was their goalkeeper shot and scored during a penalty shootout. Read more here: http://www.dailytargum.com/article/2015/11/rutgers-defeats-no-1-virginia-in-penalty-shootout-advances-to-college-cup