When two people "hit it off", it means that they become very friendly with each other soon after they first meet. When you think of people "hitting it off", you imagine that they are talking to each other and laughing a lot.
This phrase is usually used to talk about people who become attracted to each other romantically. But it can also be used in other situations, like when two couples meet and like each other:
We really hit it off with your friends Maggie and Shaun.
"Hit it off" is a phrase that can be used by people of any age, but is probably not that often used among teenagers or younger people.