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, and Yoshi's Island DS. 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, the countdown will begin. The countdown will stop when Yoshi grabs Baby Mario (or any other baby in Yoshi's Island DS) in a bubble. Stars and Middle Rings will give the player one and ten more seconds, respectively, up to a maximum of thirty. If the Countdown Timer reaches zero, a few Toadies come and steal Baby Mario (or whichever baby is currently riding on Yoshi's back in Yoshi's Island DS).
When the Yoshi retrieves the baby, 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. 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 and 20-Point Stars to increase the timer by ten and twenty seconds respectively.