In an absorbing match, the 23-time Grand Slam winner was outmuscled by the Kazakh, who will now seek to take advantage of an open women's draw.
The American tried to lift her level but instead became the latest top-10 seed to depart the women's singles.
Her next chance to equal Margaret Court's record of 24 Grand Slam singles titles comes at Wimbledon from 28 June.
"It was definitely close," Williams said. "There is literally a point here, a point there, that could change the whole course of the match.
"I'm not winning those points - they could literally change everything."
Questions about how long she can keep competing at Grand Slams are inevitable but the 39-year-old is not giving much away.
"I'm definitely not thinking about it at all," she said.
"I'm definitely thinking just about other things but not about that."