C it is
This is testing the gerund phrase form. Gerund phrases act as noun(either subject or object). Let's break down the sentence.
Making the pilgrimage to Mecca at least once in a lifetime, if they can afford it, is one of the five obligations of devout Muslims.
The bolded portion is a gerund phrase acting as a subject noun. Replace it by X and you will see what I mean:
X, if they can afford it, is one of the five obligations of devout Muslims.
Now, when speaking of "to afford", something is either
affordable or
someone can afford something. Since "if they can afford it is only a parenthetical element, it can be removed and the sentence must make sense.
subject: X(also a noun)
verb: is
object: one of the five obligations of devout Muslims
Hence, we are not saying that X is affordable but that X is one of the five obligations[...], what is between the bracket must end in the object form "affordable".
"if they can afford it" --> "they" properly refers to "devout Muslims" and "it" properly refers to X(Making the pilgrimage to Mecca at least once in a lifetime)
C is best