How did the dark square bishop get out?
Is this position legal?

The position is legal. As noted before, White's Queenside Bishop could not have gotten out, so it was captured on its home square by a Knight. Note that White is missing a pawn, so the missing pawn must have promoted into a Bishop. The only squares it could have done this are b8 or d8 (not c8, as that is a light square). To do this, the pawn would have to make 3 captures - once to get onto the d file, once to get onto the c file, and once to make it either to the b file or to return to the d file. Since Black is missing exactly three pieces (2 Knights and a pawn), it is these three pieces that the white pawn captures on its way to promotion. A sample proof game is given below.
Is the position shown below legal, and why or why not?