From the Super Mario Wiki
The Countdown Timer is a feature in Super Mario World 2: Yoshi's Island, Yoshi's Island: Super Mario Advance 3, Yoshi's Island DS, and Yoshi's New Island. It was known as just the Timer in the original release of the game. This feature is first explained in the "Welcome to Yoshi's Island" level. If Yoshi hits an enemy, Baby Mario (or any other baby in Yoshi's Island DS) flies away in a bubble and starts crying, and the countdown begins, indicating how long the star powers can protect them. If the Countdown Timer reaches zero, a few Toadies come and steal Baby Mario (or whichever baby is riding on Yoshi's back in Yoshi's Island DS).
The countdown will stop when the Yoshi retrieves the baby, and the Countdown Timer will slowly restore to ten seconds. However, if Yoshi recovers the baby while the Countdown Timer is above ten seconds, no increase is awarded. Stars add give Yoshi one more second to the timer, and Middle Rings give Yoshi ten more seconds, up to a maximum of thirty. The Countdown Timer also plays a part in determining the score for completing a level, with a point awarded for each second left on the timer.
In Super Mario World 2: Yoshi's Island and Yoshi's Island: Super Mario Advance 3, in addition to collecting individual Stars to increase the timer, the Yoshis can use items called 10-Point Stars (which gives Yoshi ten more seconds when used) and 20-Point Stars (which gives Yoshi twenty more seconds when used).