Idiom for the phrase "someone who gets what he deserved"
I think the most common phrase I hear that works for good and bad is karma (is a bitch/beauty).
(in Hinduism and Buddhism) the sum of a person's actions in this and previous states of existence, viewed as deciding their fate in future existences.
A common set of idioms to reflect the results of bad/good karma.
- what goes around comes around
- you make the bed that you lie in
- you reap what you sow
Just deserts : When a bad or evil person gets their just deserts, they get the punishment or suffer the misfortune that it is felt they deserve.
If you fly with the crows, you get shot with the crows If you wish to be associated with a particular high risk and/or high profile situation and benefit from the rewards of that association, you have to accept the consequences if things go wrong - you cannot dissociate yourself.
Consider Get what's coming to one and have it coming.
What's coming to one: what one deserves (typically get/have what's coming to one; give one what's coming): If you cheat, you'll get in trouble. You'll get what's coming to you; They gave Billy what was coming to him.
Have it coming: to deserve something : We worked so hard to make the business succeed that I think we have it coming; The jury felt the guy had it coming, so they didn't convict her of attacking him.
- Other expressions are:
Whosoever sows the wind shall (or will) reap the whirlwind.
Live by the sword, die by the sword.
Payback time.
Also, here is a nonexhaustive list of related phrases you might want to consider.
"The chickens have come home to roost" applies primarily when a person deserved bad results and got them, though on rare occasions it has been used to describe situations where a person has deserved good results and got them. In general, however, it indicates undesirable consequences returning on a person for prior misdeeds or delinquency.
Note: In my original answer I asserted that the phrase "applies whether the person deserved good results and got them or deserved bad results and got them." After further research, I am now convinced that this wording misrepresents the weight of actual usage of the phrase. See Can "the chickens have come home to roost" have positive as well as negative connotations?.
Poetic Justice might suit, although it does tend to imply a healthy dose of irony in addition to simply getting what you deserve.