All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
There is no authentic text – as far as we know – that specifies the punishment that will be inflicted on the person who masturbates. However, masturbation is like all other sins that are between the servant and his Lord. So, if the person does not repent from it before death, or if it is not erased as a sin by the good deeds and the calamities one encounters in this life, then that person will be punished or forgiven by Allah, as Allah does what He wishes.
Indeed, the servant should give up all kinds of sins, whether minor or major, because sins have a very bad impact on the person in this worldly life and the Hereafter. The person should fear Allah while thinking of committing a sin. He should have in mind the Greatness of Allah Who Sees him. So, any sin the person does might be a cause for his destruction.
For more benefit on the prohibition of masturbation, please refer to Fataawa 179859, 376036, 87952 and 81167.
Allah knows best.