For help from Apple on iOS device audio see

No Sound? Your device may be on mute. Many media apps like Netflix, Music, or YouTube still play audio even when iOS is muted. Most games like Brusheez do not output sound when the device is muted.

If you don't hear sound until headphones are plugged in, your device is most likely on mute. Also check that the volume is not too low, this is separate from muting.

An iOS device can be muted by hardware (check the switch on the side) or software. On iPad the switch can be set to lock the screen rotation instead of mute. To check if the device is muted in software, bring up the Control Center by swiping up from the bottom of the screen and tapping the mute button. On iPhone X or later or iPad with iOS 12 or later, swipe down from the upper-right corner of the screen.