There is no immediate penalty, normally the opponent notices the illegal move and points it out, and the player has to undo the illegal move and continue with a legal move. Now if the player disobeys, then the opponent is able to declare the game forfeit.
An interesting edge case is if the opponent does not notice the illegal move. See FIDE for details.
An interesting edge case is if the opponent does not notice the illegal move. See FIDE for details.