The world was positively inferred to be spherical as far back as the 3rd century BCE by Aristotle, based on differences in star maps, and how the Sun did or didn't cast a shadow at the summer solstice, at different latitudes. Around 240 BCE, Eratosthenes calculated the Earth's circumference with 15% or less error.
As Islam spread, Muslims needed a way to figure out the direction of Mecca, as well as what days to plan for religoious observations determined by the lunar calendar. Or more properly, they needed a faster, less tedious method than the early iterative processes. From this need arose early spherical trigonometry.