Slater was watching the boats and skis proceeding to the lineup when he happened to notice the shark attack.
The surfer ran up to the beach to assess the situation and was happy to see that Fanning wasn't harmed at all.
Nevertheless, Slater admitted that he was upset and speechless by the whole event because he was close to witnessing a shark eat his friend.
As soon as Fanning came up to the beach, Slater gave his friend a hug.
— WAtoday (@WAtoday) July 20, 2015
Slater actually lost to Fanning in the semi-finals in South Africa, though his ranking has risen from 11th place to sixth.
Meanwhile, Fanning was in position for the final contest between him and fellow surfer Julian Wilson, when the attack happened.
According to Fanning, he was waiting for his turn when he felt something tug or get caught in his leg rope, and he automatically jumped away from his board.
The Australian surfer only saw fins going after his surfboard as he kicked and screamed.
When Fanning felt the shark come for him, he hit it at its back and swam away.
Only the Australian surfer's board sustained injuries, with a small indentation and bitten leg rope.
Fellow surfer and finalist Wilson also saw the whole thing happen, from the time the shark appeared behind Fanning and bumped him off his board. Fanning and Wilson were both vying for first place but the contest was cut short due to the shark attack.
Eventually, both surfers were awarded second-place and received cash prizes.
— news.com.au (@newscomauHQ) July 19, 2015
But Wilson exclaimed that he doesn't care about the outcome of the finals, as he was just pleased to know that Fanning was alive.