You do not need a gym to build muscle! The principles of resistance training can be applied using bodyweight exercises. This is evident when looking the bodies of gymnasts, who almost solely use bodyweight exercises in their training.
The important thing to remember, though, is to keep finding harder and harder exercises to do, as normal pushups and pull-ups only get you so far.
For beginners, evidence shows that doing lighter exercises leads to muscle hypertrophy (building muscle), as long as you work to failure.
For more experienced athletes, find exercises hard enough so that you can do 8-12 reps before failure! These tougher exercises will also better develop your strength!
Sources:
1: Papavasiliou A. The gymnasts’ hip and groin: a magnetic resonance imaging study in asymptomatic elite athletes. Skeletal Radiol. 2014 Aug;43(8):1071-7.
2: De Carli A. The gymnast’s shoulder MRI and clinical findings. J Sports Med Phys Fitness. 2012 Feb;52(1):71-9.
3: Schoenfeld BJ. Is there a minimum intensity threshold for resistance training-induced hypertrophic adaptations? Sports Med. 2013 Dec;43(12):1279-88.
4: Schoenfeld BJ. Effects of Low- vs. High-Load Resistance Training on Muscle Strength and Hypertrophy in Well-Trained Men. J Strength Cond Res. 2015 Oct;29(10):2954-63.