This post describes illegal moves.
There are some illegal moves in shogi. These moves are called "kinjite (禁じ手)" in Japanese. A player who makes illegal move losses immediately.
However, if neither player notices an illegal move, the player who makes an illegal move does not lose.
Type of the Illegal moves; Kinjite
Illegal moves are as follows.
Two Pawns; Nifu
"Two pawns" is the condition that two or more pawns line up in the same row as shown in the lower figure. "Two pawns" is one of the illegal moves, and is called "nifu (二歩)" in Japanese.
In addition, two or more promoted pawns lined in the same row is not illegal as shown in the lower figure.
Drop Pawn Mate; Uchifuzume
Checkmate by a dropped pawn is illegal as shown in the lower figure. it's called "Drop pawn mate," or called "uchifuzume (打ち歩詰め)" in Japanese.
In addition, checkmate by a moved pawn is not illegal as shown in the lower figure.
Dropping or Moving a Piece to Position Where It cannot Move
A pawn, a knight or a lance cannot move backward. Therefore, these pieces that have moved too far cannot move as shown in the lower figure.
Dropping or moving a piece to the position where it cannot move is illegal. A player has to promote a piece if the piece moved to position where it cannot move. All promoted pieces can move backward.
Perpetual Check Four Times
If a player checks the opponent's king four times in the same game position the player loses a game. It's called "perpetual check" or "sennichite." This situation is so complicated and so rare that I will explain in detail in another post.