It's a figurative expression that's on its way to becoming an idiom
The original meaning of "rain check" was a token that was given out when an outdoor event was cancelled by rain allowing the holder to attend the rescheduled event when it took place. This usage is largely archaic as most ticketing is now electronic and there is no need for the physical rain check.
The expression was coopted by department stores to allow a person who couldn't buy a sale item because it was out-of-stock to buy it later at the sale price when new stock arrived. You still occasionally see it in advertisements usually in the form of "No rain checks", however, it's more common to see the more straightforward "While stocks last".
This general meaning: being able to take advantage of an opportunity latter that circumstances prevented you from utilising now transferred to social settings. So the expression "take a raincheck" means I can't socialise with you at this opportunity but I would love to do so in the future. So, for example, a friend invites you to the football and you say "I'll take a rain check" meaning "I can't do that but it's not because I don't want to do things with you so please keep asking me". Of course, like all social interaction, it could also mean that you hate their guts and are too polite to say so.
It originated in North America but spread to most varieties of English - I have seen it used in Britain, Australia and New Zealand - I can't speak for South Africa or India.