Williams, 36, posted a video of her session in an Instagram story.
"Ok, it's been a few weeks ... Let's try this," she wrote. She then posted a looped version of her striking a powerful right-handed serve.
After that scene, Williams cut to another showing a crowd gathering outside of the gym where she was working out.
"I've got a little fan crowd following me," she wrote.
Williams is ranked No. 183 by the Women's Tennis Association. She withdrew from the 2018 French Open on June 4, ahead of a fourth-round match against Maria Sharapova. Williams complained of a pectoral injury during the tournament. She said she could not serve due to the injury. The day after the injury, Williams had an MRI in Paris.
She said that she received "super exciting" news after the exam.
Wimbledon 2018 is the next Grand Slam on the tennis circuit. The grass court tournament begins on July 2 in London.
Williams has won seven of her 23 career Grand Slams at Wimbledon. Her last title came at the 2017 Australian Open, when she was two months pregnant with daughter Alexis Olympia.