An extra day is added to February every four years to synchronize the Gregorian calendar with the solar calendar. One year in the solar calendar is 5 hours, 48 minutes and 46 seconds longer than one year in the Gregorian calendar, the calendar used by most modern countries.
The addition of an extra day to the month of February began during the Roman Empire. At that time, the last month in the Roman calendar was February, and the emperor Julius Caesar decreed that the extra day should be added at the end of each fourth year.
After noting that the Roman calendar and the solar calendar still did not properly align over time, Pope Gregory XII introduced the Gregorian calendar in 1582.