An idiom is a phrase or an expression that has a meaning different from the literal meaning.
Option B: 'Pillar to post' is an idiomatic expression that means 'forced to keep moving from one place to another'.
It forms a complete and meaningful sentence here. 'He' had to keep moving from one place to another to get a job.
Hence option B is correct.
Options A, C and D:
'Office to office', 'pillar and post' and pillar to pillar' are not idiomatic expressions. They have a literal meaning, and do not form a complete meaningful sentence.
Hence options A, C and D are incorrect.