Williams had to have her left knee heavily taped during the match
Canada's Aleksandra Wozniak reached the second final of her career when top seed Serena Williams retired from their semi-final at the Stanford Classic.
The 20-year-old world number 85 was leading 6-2 3-1 when Williams pulled out with a knee problem.
Wozniak will face France's Marion Bartoli in the final after she beat Japan's Ai Sugiyama 6-3 6-3.
"I expected to win this tournament and have a strong start (to the hard-court season)," said Williams.
"My goal was to win here and I think I would have done it otherwise."
Williams reached the Wimbledon final on 5 July, losing to her sister Venus, and then decided to play four matches in the World Team Tennis league.
She said she first started feeling pain in her Saturday morning practice, but it was not in the same area of the left knee where she had surgery in August 2003.
Wozniak kept moving me and I was hoping she wouldn't
"After I got off it was really swollen," she said. "I've been playing a lot of tennis so I think that's what it is. When you have inflammation in a joint it's hard to move.
"Wozniak kept moving me and I was hoping she wouldn't."
Williams won the opening game but Wozniak came roaring back to take the next three, and closed out the set after her opponent took a medical timeout at 5-2 down.
World number five Williams had her knee taped but was still struggling early in the second set, and called it a day after 47 minutes.
"I tried to stay focused on me. I knew I would play a big champion," said Wozniak.
"I just wanted to play really aggressive, to take the ball as early as I could and come in when I could.
"In the middle of the first set, I saw her watching a little bit her leg. I thought it was her ankle, but in the end it was the knee."
Williams was unsure whether she would be able to compete in next week's Los Angles Classic, but said that being fit for the Beijing Olympic Games was her top priority.
It is Bartoli's first final of 2008.
Sugiyama was up a break in the opening set and leading the fourth game 40-0, when she let Bartoli back in.
The Japanese veteran lost the game, levelling the set at 2-2 after her fourth double fault of the match.
Bartoli, a surprise Wimbledon finalist in 2007, went on to win the set, and took the second without dropping her serve.