The musicians are hired in Act 4 to assist in celebrating Juliet's pending marriage to Paris on that morning. However, there ends up being no need for a celebration, nor wedding of any kind, because they believe Juliet has died. Truthfully, Juliet is in a drug-induced sleep, an idea generated by Friar Laurence to make her appear to be dead to her family with the intentions of having Romeo come to her tomb, wake her, and take her away to Mantua with him.
Also, the musicians were placed by Shakespeare for means of some comical relief at the point when Juliet's family finds her presumably dead. They are playing on while the family realizes she is dead and prepares to mourn her. Perhaps this was Shakespeare's way of alleviating the situation since it was not really as tragic as the family believed it was. The dramatic irony in this scene is what makes it comical.