Even though the text does not literally state that the child within Anna is Vronsky's it is actually implied in a number of different ways. Anna announces this news to Vronsky in Part II, Chapter 22 of this excellent novel, and it is clear from both of their reactions that both Anna and Vronsky are in no doubt that her child is Vronsky's child. Note how Vronsky takes the news:
But at the same time, he felt that the turning-point he had been longing for had come now; that it was impossible to go on concealing things from her husband, and it was inevitable in one way or another that they should soon put an end to their unnatural position.
For Vronsky, this pregnancy is the opportunity they both had been waiting for to go public with their relationship and to no longer continue the deception that they had been living up until this stage in the text. If there was any doubt about who the father was, it is clear that Vronsky would not interpret Anna's pregnancy in this way. For Anna, of course, this pregnancy is troubling precisely because it will necessitate being open about something that threatens her relationship with her son. Her response is far more nuanced than Vronsky's, however in neither character is there the slightest shadow of a doubt that the baby could be anybody elses apart from Vronsky's baby. The text elsewhere makes clear that Anna hardly sees her husband any more, so it is impossible that it would be his.
Tolstoy doesnt say for certain that the child is Vronsky's because he wants the reader to make that connection themselves. While many hints were dropped throughout the story, the text does not literally say it, so inferences can be made. By the time Anna becomes pregnant it can be reasonably inferred that she is no longer having any "relations" with her husband, but instead spending more and more time with Vronsky.