Slang refers to words that are used informally, and often only among subgroups. Slang is often short-lived: it may go out of date among the group that uses it after a few months.
Slang words or expressions are very informal, and are more common in speech than writing. Use of these words/expressions are often restricted to a particular context or group of people, or within a specific region/place.
An idiom is a fixed phrase whose meaning cannot be deduced from the meanings of the component words. “To kick the bucket” is an idiom in English that has nothing to do with kicking or buckets. It means “to die.”
Idioms are phrases or fixed expressions whose true meaning cannot be deduced from their constituent words. Although idioms may often appear to have literal meaning, their true meaning is often very different.
For example, the idiom couch potato means a sluggish person whereas the individual words: ‘couch’ means ‘sofa’ and ‘potato’ is a vegetable. Another one is “I feel like kicking myself” doesn’t mean you are going to kick yourself. It actually means that you are so disappointed with yourself that you feel like kicking yourself.
Figure of speech
Figures of speech are words or phrases used figuratively, in a non-literal sense, for effect. Figure of speech is a blanket term which encompasses many things such as: similes, metaphors, hyperbole, personification.
A figure of speech is also usually a fixed phrase, but you can often figure out how it is being used metaphorically in context.
It expresses things figuratively and not literally. It is possible to understand a figure of speech even if you have never heard it before unlike an idiom. Idioms are words which must be familiar to the speakers for a thorough understanding. Similes, Metaphor and Hyperboles are some examples of figures of speech. For example, saying “I’m starving” doesn’t actually mean you will be dead without food. It simply is a hyperbole to saying “I’m hungry”.