Funder and publisher's sharing policies should provide details on when you need to share.
For funders, it's common to require sharing at the end of the funding period or the project.
For publishers, it's common for sharing to be required at the time of publication of the research.
Some researchers may wish to share data more regularly during the research process, whenever datasets are ready for feedback, review or reuse, or in conjunction with events such as the publication of a preprint or presentation at a conference.
The considerations and recommendations in this guide apply no matter when or why you're sharing your data.