As a tourist, I buy it there. That way I know it's reef-safe without having to look at ingredients, and the few dollars spent vs. carrying a bottle through an airport is well worth it.
Many of the dive boats and hotels will offer sunscreen out of a bulk pump, so depending on what you do on the islands, you probably don't need much on your own - just a small tube for your group will do.