What does the bold phrase below mean? Why do they use the possessive? Why do they use the noun time?
Yes, but he's getting married in three months' time.
I have understood this sentence
Yes, but he's getting married in three months.
This is called the genitive or possessive case, a holdover from Latin. The first noun modifies the second. It's usually, but not always, seen with the possessive apostrophe. More specifically, when used this way, it's the genitive of measure, and it's considered archaic. You can use it for distance as well, as in "a day's travel" or "an hour's walk." The word time is used to distinguish the measurement from some other scale.
It's important to distinguish possessive case from actual possession. In this example, "the time belonging to three months" makes no sense. The true meaning is closer to "a period that lasts three months," as the OP indicates.