If it was an accident, the rocket sure chose a good piece of the vast ocean on which to land.
The ship is important because it vastly reduces the fuel needed for the landing maneuver.
The Falcon 9 first stage can make it all the way back to Kennedy to land, but if it does that, the payload must be smaller, and/or it has to shoot for a much lower orbit. Higher orbits and larger payloads, they either have to just let the first stage be disposable, or make the ocean landing on the barge.
It's one of the most clear-cut distinctions you'll ever see between the government and the private sector the government tried to "save money" with reusable spacecraft in the Shuttle, and it wound up costing more than completely disposable boosters, and SpaceX took completely disposable boosters, and made them reusable at an estimated actual 30% savings.