The above response is probably a large part of it, where the physical and mental excitement, along with the hormones it release, can be similar to or mimic a fight or flight response. In these situations, and in bouts of physical activity, especially high intensity, which depending on how you masturbate may be part of the equation, your body knows it may be about to partake in rigorous physical activity, be it to run, fight, or have sex. So in response, your body releases glycogen (storage sugar) into the blood stream so that your muscles and other systems have it ready for use, especially if it is an emergency. The more excited you are, scared, or intensely active, the greater response may be made, thereby increasing your blood sugar levels.