Before the bishop and queen acquired their current moves in the 16th century, their weak powers meant that the king was relatively safe in the middle of the board. When the bishop and queen got their current moves, they became very powerful, making the king no longer safe on its original square since it can be attacked from a distance and from both sides. Castling was added to allow the king to get to a safer location and to allow rooks to get into the game earlier.
Diagram - in this game Black castled on the 9th move but failed to provide an escape square for the king
White's decisive move ?