Sparging is essentially just rinsing sugars off of the grains after a mash. For example (and easy math so we're ignoring grain absorption), if you wanted 7 gallons for the boil, had 10 lbs of grain, and mashed in at 1.2 qt/lb you'd have 12 qts (3 gallons) of high gravity wort. Since you're still 4 gallons shy, you could run those 4 gallons through the grainbed to rinse sugar off of the grain.
Brewers sparge to increase efficiency. If you mash with your full volume of water for the boil, sparging isn't possible. FWIW, I don't sparge since I BIAB and mash with the full volume of water needed. Some BIAB brewers do sparge.
In short, it's not necessary to produce beer but it can boost your efficiency numbers