Final answer:
The correct preposition to use in this sentence is 'in'. It indicates involvement or participation in a habit.
Step-by-step explanation:
The correct preposition to use in this sentence is in. So the sentence should be: 'I came to learn that you got in the habit of smoking recently.'
The preposition 'in' is used when we want to indicate that someone is involved in or participating in an activity or habit. In this case, the person has become involved in the habit of smoking.
For example, you could say 'He got in the habit of going to the gym every day' or 'I got in the habit of reading before bed.'