The Russian tennis great pointed to the level of competition when encouraging Williams to make one final comeback to the tennis court.
The American won three of her seven singles matches since returning to competitive action at Wimbledon.
Two of those victories came at the ongoing US Open as Williams reached the third round before hanging up her racket for the final time.
Sharapova, who was part of the ESPN commentary team during the women's semi-final between Ons Jabeur and Caroline Garcia, said: "It was amazing to see Serena's run and the glory and the gracious tenacity as she carried through to the end of her career."
She later added: "We spoke about it at the net last year during this time of year and I said no disrespect to this generation but you are so much better and you need to go out there, so I'm glad that she had a chance here."
Sharapova and Williams are on friendly terms despite their long running rivalry on the tennis court.
The pair squared off 22 times on the WTA Tour, with Williams going on to win 20 of those encounters.
One of Sharapova's wins over Williams came in the final of the 2004 edition of Wimbledon.
Williams, however, won the next 19 matches against the Russian which included eight grand slam finals.