Mormonism believes "that God’s [first] commandment for His children to multiply and replenish the earth [Gen. 1:28] remains in force". Does this mean all Mormons must marry and have children? Or can some be perpetual virgins? What about infertile or childless marriages?
Does this mean all Mormons must marry and have children?
'Must' is a strong word, Mormons believe in agency: the ability and privilege God gives us to choose and to act for ourselves. As with all commandments, Mormons believe we have a choice, however, if we want the blessings, promises, or protection a commandment brings then we should/will make the choice to keep God's commandments.
If a Mormon wants to attain exaltation, the highest glory of the celestial kingdom, then they must marry, be sealed, and live faithfully to their covenant.1
to multiply and replenish the earth
and while there is not a specific blessing attached to this command, we know that God blesses us for keeping the commandments. So if you want the potential blessings yes.2
Or can some be perpetual virgins?
Yes, because Mormons believe in agency, no if they want the same blessings and promises to those who are sealed.
What about infertile or childless marriages?
God knows the intents and desires of our hearts.3 Mosiah 4:24-25 says:
24 And again, I say unto the poor, ye who have not and yet have sufficient, that ye remain from day to day; I mean all you who deny the beggar, because ye have not; I would that ye say in your hearts that: I give not because I have not, but if I had I would give.
25 And now, if ye say this in your hearts ye remain guiltless, otherwise ye are condemned; and your condemnation is just for ye covet that which ye have not received.
This lets us know that God will judge us based on our desires. So if we have righteous desires but are unable to act on them for some reason we can still attain the blessings.
President Harold B. Lee relied on these scriptures in another example:
“[Women] who have been denied the blessings of wifehood or motherhood in this life—who say in their heart, if I could have done, I would have done, or I would give if I had, but I cannot for I have not—the Lord will bless you as though you had done, and the world to come will compensate for those who desire in their hearts the righteous blessings that they were not able to have because of no fault of their own.” (Ye Are the Light of the World, Salt Lake City: Deseret Book Co., 1974, p. 292.)4
Because in the context of the LDS Church, where the family is celebrated as the fundamental unit of society, childlessness can be an especially difficult challenge. There are many articles to address those facing infertility:
It is a commandment. Mormons, or members of The Church of Jesus Christ of Latter-day Saints, believe that the family is the most important institution under God's plan, they also believe that strong families is the base of a strong society. In the same document you linked we can read:
The family is ordained of God. Marriage between man and woman is essential to His eternal plan. Children are entitled to birth within the bonds of matrimony, and to be reared by a father and a mother who honor marital vows with complete fidelity.
Mormons believe that individuals must keep the commandments to the best of their abilities. This is an individual matter, so others shouldn't judge why someone isn't married or why couples don't have children. There are people with various challenges that limit them to keep these commandments to the fullest such as infertility, other health conditions, sometimes even local law, etc. What is important is that each individual is genuinely doing the best they can. I know couples that couldn't have children no matter how much they tried, they decided to adopt children.
No one is forced to marry just as no one is forced to attend college — but if you want that college degree (at least one worth getting), you must attend college and get good grades.... Good college degrees, like exaltation, are not simply given away.
The LDS Church believes that the Celestial Kingdom is divided into three divisions. We know precious little about them, but we are taught that to obtain the highest of these divisions, we must enter into the "new and everlasting covenant of marriage."
(All abridgement and emphasis in the quotations below are mine.)
In the celestial glory there are three heavens or degrees; and in order to obtain the highest, a man must enter into this order of the priesthood [meaning the new and everlasting covenant of marriage]; and if he does not, he cannot obtain it. He may enter into the other, but that is the end of his kingdom; he cannot have an increase. (D&C 131:1-4)
The LDS Church believes marriage (a Temple sealing) is a mandatory ordinance for exaltation.
Rule #1: If all you aspire to in this life is a worldly marriage, that is all you will enjoy. Thereafter you are merely an angel (see D&C 29). Note that this has no condition of being a member of the LDS church or not.
Therefore, if a man marry him a wife in the world, and he marry her not by me nor by my word ... their covenant and marriage are not of force when they are dead, and when they are out of the world.... Therefore, when they are out of the world they neither marry nor are given in marriage; but are appointed angels in heaven, which angels are ministering servants, to minister for those who are worthy of a far more, and an exceeding, and an eternal weight of glory. For these angels did not abide my law; therefore, they cannot be enlarged, but remain separately and singly, without exaltation.... (D&C 132:15-17)
Note that phrase, "which angels are ministering servants, to minister for those who are worthy of a far more, and an exceeding, and an eternal weight of glory." There is no definitive proof, but this suggests that people who are otherwise worthy of the Celestial Kingdom are rewarded one of the two lower divisions of the Celestial Kingdom. Note, please, the phrase "otherwise worthy." Even a worldly marriage must be honorable, faithful, etc. to receive either lower division of the Celestial Kingdom.
Rule #2: If you were sealed in the Temple for time and all eternity, but that sealing/marriage failed to be recognized (sealed) by the Holy Spirit of Promise, you're out of the Celestial Kingdom. The best you can get is the Terrestrial Kingdom.
...If a man marry a wife, and make a covenant with her for time and for all eternity, if that covenant is not by me or by my word, which is my law, and is not sealed by the Holy Spirit of promise ... then it is not valid neither of force when they are out of the world ... they cannot, therefore, inherit my glory; for my house is a house of order, saith the Lord God. (D&C 132:18)
This fits neatly with the Parable of the Faithless Servant found in Luke 12:41-48, which concludes, "For unto whomsoever much is given, of him shall be much required: and to whom men have committed much, of him they will ask the more." Members of the Church are expected to know better. Having been given the opportunity to receive the highest division, they are held to a higher standard.
It also fits neatly with John's statement in Revelation:
I know thy works, that thou art neither cold nor hot: I would thou wert cold or hot. So then because thou art lukewarm, and neither cold nor hot, I will spue thee out of my mouth.
The Lord respects a firm yet wrong decision above making no decision at all. Or, said another way, if you're handed the brass ring and let it tarnish, it's worse than if you'd never been handed the brass ring at all. It is better to willingly choose a worldly marriage because you know you can't abide by the rules of a celstial sealing than to accept the celestial sealing and then treat it as dross. (What does this mean? That's an answer to another question.)
Rule #3: If you are sealed by proper authority and your sealing/marriage is sealed by the Holy Spirit of Promise then you are in this one thing worthy of the highest division of the Celestial Kingdom. You must also be obedient and faithful in all other things (e.g., a perfect husband who's a lazy minister will not receive the glory: but that's yet another answer for another question).
And again, verily I say unto you, if a man marry a wife by my word, which is my law, and by the new and everlasting covenant, and it is sealed unto them by the Holy Spirit of promise, by him who is anointed, unto whom I have appointed this power and the keys of this priesthood; and it shall be said unto them—Ye shall come forth in the first resurrection; and if it be after the first resurrection, in the next resurrection; and shall inherit thrones, kingdoms, principalities, and powers, dominions, all heights and depths—then shall it be written in the Lamb’s Book of Life, that he shall commit no murder whereby to shed innocent blood, and if ye abide in my covenant, and commit no murder whereby to shed innocent blood, it shall be done unto them in all things whatsoever my servant hath put upon them, in time, and through all eternity; and shall be of full force when they are out of the world; and they shall pass by the angels, and the gods, which are set there, to their exaltation and glory in all things, as hath been sealed upon their heads, which glory shall be a fulness and a continuation of the seeds forever and ever. (D&C 132:19)
It's the beginning of verse 20 that tends to cause a bit of controversy, but it makes the point very clearly.
...Then shall they be gods, because they have all power, and the angels are subject unto them.
That's what it means to recieve the highest division of the Celestial Kingdom: to be rewarded with all that the Father hath.
Choosing perpetual virginity is no different than choosing a worldly marriage: in the end, you're single (Rule #1). Therefore, the choice to be a perpetual virgin will (all other obedience assumed) gain you the first or second division of the Celestial Kingdom. But if you're not willing to take on the greater responsibility of family, you will not be given the keys to the highest division of that kingdom.
But, what about childless/infertile marriages?
This needs a more lengthy treatment than I'm going to give it here. Fundamentally, a person is only accountable for a command they can both understand and obey (see 2 Nephi 9:25 and Moroni 8:10 for instance). Were this not so, a great many people with disabilities that prohibit "normal" (whatever that actually is) observance and obediance would be judged sinners unfairly.
For example, a person who cannot comprehend the covenant of baptism and the accountability it entails is not required to be baptized. (Regrettably, these instructions are only found in Handbook #1, which is restricted to Church leadership. However, the basic rules can be found in this Ensign article from 1976.)
Consequently, people who cannot conceive children are not accountable to the law to multiply and replenish the Earth. Those who can and choose not to, however, are subject to Rule #2.
One more thing...
As with most gospel rules, there are a thousand "but what about this situation?" issues that the Lord has not yet revealed and may never reveal. In these instances, I tend to trust in the following verse from Moroni:
Yea, come unto Christ, and be perfected in him, and deny yourselves of all ungodliness; and if ye shall deny yourselves of all ungodliness, and love God with all your might, mind and strength, then is his grace sufficient for you....