All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Masturbation is forbidden as clarified in Fatwa 81150, and when one ejaculates after masturbation, he is obliged to perform Ghusl (i.e. a ritual bath). The Ghusl that is acceptable and sufficient when one is impure due to sexual defilement is to pour the water all over the body once while having the intention of purifying yourself from sexual defilement. Therefore, if you used to pour water all over your body, your Ghusl is correct even if you did not know the obligations of Ghusl as long as you poured water all over your body having the intention of purifying yourself from the state of impurity.
However, if you did not pour water all over your body, then you are obliged to make up for all the prayers which you performed after that Ghusl even if they were many prayers.
For more benefit on the sufficient and acceptable Ghusl from sexual defilement, and the Ghusl according to the Sunnah, please refer to Fatwa 81405, and to Fatwa 83727 about how to make up so many missed prayers.