A statement issued by BNP Paribas Open organisers in California quoted Williams as saying she was withdrawing because of a problem with her left knee.
"Sadly, I have to withdraw from the BNP Paribas Open in Indian Wells and the Miami Open," Williams said.
"I have not been able to train due to my knees and am disappointed I cannot be there. I will keep moving forward and continue to be positive. I look forward to being back as soon as I can."
Organisers of this week's event in Indian Wells , which gets under way on Friday, said a revised draw would be issued later.
Williams's withdrawal means Germany's world number two Angelique Kerber will take over the world number one ranking at the conclusion of the BNP Paribas Open, which ends on March 19.
Williams, 35, has not played since defeating sister Venus in the final of the Australian Open in January to clinch a record 23rd Grand Slam singles title.
The American star finished runner-up in the Indian Wells final last year, a tournament she only started playing again in 2015 after a 13-year boycott.
Williams has long been a staple at the Miami Open, winning the tournament a record eight times with her most recent victory coming in 2015.
This year's tournament runs from March 21 to April 2.