If you want to a continuous rotation (= a changed rotation value in every frame), you need to do the change in the process (or physics_process) function.
Let's assume you have a variable is_jumping
which is true while your player is in the air and false when he's back on the ground. Then you can simply add this code to your process function:
if is_jumping:
rotation += 5 * delta
else:
rotation = stepify (rotation, PI / 2.0)
Means: Rotate while jumping, and snap to the closest 90° angle otherwise.