I can think of three possibilities.
It got hit by a late frost or freeze while it was flowering.
The bees in your area have disappeared and the flowers aren’t getting pollinated.
It got sprayed with an insecticide while it was in flower which can prevent fruit formation (as well as killing the bees that were trying to pollinate it).