The correct option is
B them
This sentence has two objects: direct and indirect. The direct object receives the action and the indirect object is the recipient of the direct object (thereby, indirectly, at the receiving of that action).
The direct object in this sentence is 'some candy'.
Option A: We use 'to' before the indirect object, when the indirect comes after the direct. Since that isn't the case here (it comes before), 'to them' is not the right option.
Option C: 'They' is a subject pronoun. It is used when an action is performed by that subject. But, here, the pronoun should be receiving an action.
Option D: In 'for them', the preposition 'for' refers to a purpose 'for the sake of'. It does not form a meaningful sentence here.
Hence options A, C and D are incorrect.
Option B: 'Them' is an object pronoun and is most appropriate here, as an indirect object.
Hence option B is correct.