You can't call "giving" in your example "gerund" which is:
The gerund (/ˈdʒɛrənd/ or /ˈdʒɛrʌnd/) is a non-finite verb form that
can function as a noun in Latin and English grammar. The English
gerund ends in -ing (as in "I enjoy playing basketball"). The same
verb form also serves as the English present participle (which has an
adjectival or adverbial function) and as a pure verbal noun. Thus the
-ing form in the English language can function as a noun, verb, adjective or sometimes adverb; in certain sentences the distinction
can be arbitrary.
As the above explanation states, it is a bit tricky and arbitrary to tell which is "gerund" and which is "present participle". However, one thing to note is "gerund" is used as a noun.
Giving (spreading) the disease to her family was terrible. (It was terrible giving the disease to her family)
In the above sentence, "Giving" was used as a subject of the sentence. It is a gerund. However, in your example:
She was out of school for a long time when she caught the measles,
giving the disease to her family.
It can't be a gerund because a noun can't stand alone in a sentence (some exceptions exist though). That's why it is a "present participle".
As commented above, it is called "participle clause/construction' and its primary purpose is to omit; (1) a conjunction, (2) a subject (when it is the same as the independent clause).
She was out of school for a long time when she caught the measles and she gave the disease to her family.
This sentence can be shortened using the "participle clause/construction". It doesn't matter whether there are simultaneous or sequential actions. It will be judged by the context.
I advise you to visit the site recommended in the comment and learn how it works.