From the Super Mario Wiki
A Time Limit (or simply Time) is instituted in almost every platformer game, and its basic purpose is to notify the player of how much time is allotted to complete a level or task. It is a prominent element in the Mario platformer games.
While the player is in a level, the time limit decreases at a steady rate until it reaches zero. If the player does not finish the level when time is up, they automatically lose a life and have to start the level over (or receive a Game Over when they have no more to lose). Once the player finishes a level, the remaining time is multiplied by a number and then added to the player's score (or coin total in Super Mario 3D Land). With few exceptions (e.g. in Super Mario 3D Land and Super Mario 3D World), it is impossible to increase a level's time limit.
When the time limit decreases to below 100 seconds, the hurry up theme plays to warn that the player is low on time. After that, the level's music plays slightly fast.
Games in which the time limit appears