There are really no set rules about it, Natpolitana. In general, the longer you can do it, the better, but just like Storm Crow experienced, once they get past a year and a half and are toddling around and also eating solids, too, they mostly just want to nurse for comfort and nuturing. The babies get the immunity benefits fairly fast, like during the very early weeks and months, which is, I'm sure, nature's design for protecting them when they're at their most vulnerable. A large part of the immuno-protection comes to the babies through the colostrum, which is is the "first milk" substance that isn't even really milk.
Colostrum - Wikipedia, the free encyclopedia

One of the neatest things is that pregnancies and breastfeeding both reduce a women's risk of developing breast cancer, and they lower the risk of ovarian and uterine cancer, too. No one fully understands how or why this benefit occurs, but it appears to be beneficial to the female body to give it a break from ovulation. (Just as you don't ovulate and have a normal monthly cycle when you're pregnant, you usually don't ovulate when you're nursing, either.)
Why Breastfeed?* You will have less chance of* Breast Cancer and other Cancers