Masturbation can cause no physical impairment.
Are you a teenager? Teenagers often go through a phase of being "skinny" during their growth spurt. Especially boys but also girls. Don't worry. You'll fill out. Don't try eating lots of calorific/fattening foods in order to gain weight, this could cause you real health problems. Just be sure to take exercise regularly and eat a healthy, balanced diet (you need plenty of vegetables and fruit, cabohydrate-rich starchy foods like bread, pasta, rice or potatoes; and protein such as meat, cheese, eggs etc.) and make sure you eat AT LEAST three meals a day.
If it helps at all. Both me and my brother were underweight as teenagers but now in our early and mid twenties we are of a normal healthy weight.
Stop worrying so much!
PS. masturbate as much as you like, so long as you do it privately and at appropriate times. It can do you no harm and is fun!