“may Yahweh fulfill his word.” In this case, the word of God refers to the blessing of Eli, the High Priest, who blessed Hannah, saying may God grant her request that she requested (1 Sam. 1:17), and also to the fact that what Hannah had requested was a boy, whom she would then give to God as a Nazirite to serve God throughout his life (1 Sam. 1:11). Here, Elkanah shows that he understands the promise that Hannah has made and that the High Priest blessed, and he reminds Hannah of her commitment as he left on his annual journey to Shiloh to worship. So Elkanah allowed Hannah to stay home but reminded her that there would soon come a time when she would not be able to stay home, but would need to fulfill her vow. Hannah, godly and faithful, did indeed fulfill her vow once little Samuel was weaned (1 Sam. 1:24).
“until she weaned him.” Women weaned later in ancient times than they generally do today. In part, because baby formula and other foods young children usually eat today were not available, so a weaned child generally had to eat whatever was available for the parents to eat. If 2 Maccabees 7:27 is any guide, weaning around three years old was common.