Shakespeare wrote Romeo and Juliet early in his career as a playwright, probably in 1594 or 1595. We don't know the date for certain because there were no copyright laws then and many of his original manuscripts were not written for publication in the first place. Typically one manuscript was written and shared by the entire acting company.
After Shakespeare's death in 1616, two of his fellow actors collected and published his plays in a single volume, called the First Folio, in 1623. Without this collection it is doubtful that many of Shakespeare's plays would have survived over the past four hundred years.