Bob Harper is building up his strength again following a very serious and sudden health scare.

The Biggest Loser star recently suffered a heart attack that left him unconscious for two days, TMZ reported.

Harper told the website he was exercising in a New York City gym two weeks ago when he collapsed. A doctor -- who was luckily working out at the gym simultaneously -- tended to Harper when he fell.

The doctor reportedly administered CPR and used paddles to keep Harper alive. The 51-year-old fitness enthusiast was then rushed to a nearby hospital, where he woke up two days later.

Harper was hospitalized for a total of eight days, according to TMZ, and is still in New York City because the Los Angeles native has yet to be cleared by doctors to fly in an airplane.

Harper is doing a lot better now but must limit his exercise to just walking for the time being. Just last week, he noted he was "lucky" on Instagram, although Harper did not reveal the post was related to his medical condition.

Because he is known to be healthy and fit, the heart attack probably comes as a big surprise to fans. However, the personal trainer said it's due to genetics, as his mother died from a heart attack.

Harper served as a trainer on The Biggest Loser since its first season debuted back in Fall 2004.

Harper later led post-elimination workout routines -- and conducted separate weigh-ins -- for contestants at the show's "Comeback Canyon" in Season 16.

The last season of The Biggest Loser, Season 17, premiered in January 2016 and wrapped the following month. For that edition of the reality weight-loss competition, Harper replaced Alison Sweeney as host.

Harper currently runs his website and appeared on The New Celebrity Apprentice as a boardroom adviser.