This is called an 'en passant' capture, and requires a specific combination of moves to occur.
First, the white pawn has to be in its fifth rank (the one the black pawns move to if they move two spaces on their first move).
Then, black has to move a pawn that hasn't been moved yet up two squares to land next to it. (So this only works on a pawn in an adjacent column to the opposing pawn.)
Finally, on the next move, and the next move only, white's pawn can capture the black pawn as though it had only moved one space instead of two (meaning the white pawn advances one space and moves into the column of the captured black pawn).
Essentially, the capture is like interrupting the black move partway through.