Why is en passant only possible on the first opportunity? Quoting FIDE rulebook:


  This capture is only legal on the move following this advance and is called an ‘en passant’ capture.


Quoting Wikipedia:


  The en passant capture must be made at the very next turn or the right to do so is lost.


Why?



I know the basic story of en passant and I'll just paraphrase it here: A rule was added to let pawns move two squares forward on its first move. Someone said something like, what if a pawn uses this to escape from an enemy adjacent pawn? Then the basic pawn skeleton/framework would be changed! So we must have an en passant to preserve the same chess framework.

Okay that part makes sense, but why does it have to be on the very next move? Was that part of the rule only added later? Why was it added at all? When two pawns are diagonally adjacent confronting each other, they don't have to capture immediately or else forefeit the ability to capture. So the concept of the "ghost pawn", if you don't capture it immediately, and the other player doesn't move it, seems to me like it should still be there and available for capture as long as it's there.

Does anyone know why this part of en passant was created?



Optional Background: In case you're curious, I come from a programming background. Of all the special moves, en passant is (was, see below) the hardest to program. Not only is it the only move where the capturing piece moves to a blank square, but it's the only move that "disappears" if you don't take it. That means it's a move where the total board position is not enough information to generate all moves. (That's true for castling too, which already has its fair share of tricky rules.) Two enemy pawns could be adjacent on the 4th or 5th rank, surrounded by blank squares, but you still don't know if en passant is possible. You have to check the previous move.

Or so I thought. Now that I'm revisiting this, I figured out a clever way to implement en passant without checking the move log. Don't generate it at turn start. Generate it at move_take, specifically at the end of a 2-step pawn move. But store it in a special move array since the normal one gets cleared at every inc_turn. Then migrate and clear appropriately at gen_all_moves. That way, if ep is not taken, it doesn't generate itself on the next move because you didn't move that same pawn two steps on the next move. Just remember to check both sides of the pawn and create two ep moves if two enemy pawns are there.

Castling was implemented with the help of a "moved" boolean in every piece, which is also useful for a pawn's first move of course. Even if the King and Rook are in the right spot, you use that to see if the King/Rook has moved before. No need to check the move log. But I will say that Castling is now the hardest move to implement because you gotta check if the path is under attack. En passant is no longer the hardest now that I thought of the clever way.
A pawn which 'exposes' itself to en passant will be distinct from one that doesn't. Say, for a black pawn on a4 and a white pawn on b4: giving black the option of playing ...axb3 at any time after b2-b4 means that the moves b2-b4 and b3-b4, which seemingly lead to the same position, have long-term implications as it depends too much on the past. In particular, when the pawn stands on b2, white would need to weigh the pros and cons of moving his pawn to b4 in one or two moves (where the con is giving black a long-lasting right to take on b3).

Or, in the spirit of the motivation of en passant that you correctly described, permanently stopping a two-square pawn from 'escaping' would greatly neglect (or complicate) the benefit of being able to move two squares forward.

Another practical reason because it's just much simpler for humans: with more than one pawn on the board, it would be complicated to keep track of en passant rights on all of them. (Someone once suggested that pieces be able to capture en passant at some FIDE meeting; needless to say, it was laughed out of the room --- that said, I can't recall the source of this story.)

One may ask a similar (opposite?) question about castling rights; the 'simpler' option may arguably be to always allow castling as long as the pieces are back on their original squares, but that too has strong implications, one of which is a reduced importance of development.

Generally, the special moves in chess have restrictions associated with them to ensure that they don't change the way the game 'looks' after the time these special moves are made (playing ...axb3 to take a white pawn on b4 looks completely unlike the old game, so it's only allowed for one move). After all, the rules were designed by humans, arguably arbitrarily.