The correct option is
B to him
This sentence has two objects, an indirect object (him) and a direct object (it).
The direct object 'it' receives the action 'gave', and the indirect object 'him' is the recipient of the direct object 'it'.
Option B: In 'to him', the preposition 'to' connects the direct object 'it' with the object of that action 'him'. It completes the sentence in meaning. Hence option B is correct. (When the direct comes before the indirect, we use 'to'. When the direct comes after the indirect, we don't use 'to': We gave him a lamp (it).)
Option A: 'Him' is the object, but there is no word that would connect it with 'it'.
Option C: 'His' expresses possession or ownership; it performs as an adjective here and is not followed by any noun it can modify.
Option D: 'For' refers to a purpose 'for the sake of'. It does not form any relation with both the objects here.
Hence options A, C and D are incorrect.