After Hagar gave birth to Yishmael she began to suspect that perhaps the reason Sarah did not have a child was because Sarah was not as righteous as she appeared. Sarah complained to Avraham, "Chamasi alecha!" (16:5). The word "chamas" literally means theft. What did Avraham steal? Rashi explains that Sarah accused Avraham of davening on his own behalf and not hers as well. Therefore, he was blessed with a child through Hagar but she remained barren.
A number of chiddushim worthy of attention here:
1) Theft does not just mean taking something that doesn't belong to you; it can also mean withholding something that should be given to another. Whether it's a tefilah for someone, a compliment, a good word, a good deed -- not responding with empathy and kindness to another's plight robs them of the chessed deserved (Rav Shach in Machsheves Mussar elaborates on this point a few times). My wife recently cited in one of her posts the Zohar in Parshas Tazriya (87): Just as a person is punished for hurtful speech, so too is one punsihed for not speaking well of someone when afforded the opportunity to do so (see Sefas Emes (Metzora 5661)).
2) The gemara (Yevamos 64) tells us that Sarah was physically incapable of having children. It would take no less than a miracle for her to have become pregnant. One would have thought that it would be a waste of breath to even daven for such an impossible turn of events. Nonetheless, explains R' Nosson Wachtfogel, Avraham should have davened. There is no limit to what we can ask of Hashem in our tefilos. Of course, he may not give us what we want -- but that doesn't mean we shouldn't ask.
3) It is almost impossible to believe that Avraham did in fact daven only for himself and not for Sarah. The reason Avraham is criticized becomes apparent when we contrast his behavior with the Torah's description of the tefilah of Yitzchak for Rivka. "Vaye'etar Yitzchak l'Hashem l'nochach ishto" --the Torah makes specific mention of the fact that Yitzchak davened opposite his wife, within her proximity. Avraham of course davened for Sarah -- but he never let her know he was davening for her. The Torah is telling is that it's sometimes not enough to just care; we also need to let the other person know it. (It was entirely by chance that I saw this idea quoted here by R' Tzvi Shiloni, a RA"M in YNA, in the name of his father and then it dawned on me this R' Shiloni and I were in 9th grade together,which is neither here nor there.)