Vitamin D
i don't know about other bettas, but I do believe that most CT breeders in thailand and such will sunbathe their fish because it helps prevent curling of the fins. I don't know the science behind that though, it may just be folk lore.
In anycase, your fish don't NEED to have sunlight, though they do need some form of light, which presumably they are getting from a tank or room light anyway. Also sunlight aids in the growth of algae much more than artifical light, not to mention that a fish in a small tank in the sun can easily overheat.