This quote is taken from Act II, Scene VI, in which Romeo and Juliet are secretly married by Friar Lawrence. In the first line of this quote, Friar Lawrence expresses his wish that God ("the heavens") is happy with this marriage. In other words, he hopes that Romeo and Juliet's union has divine approval.
It is important that this marriage is blessed by God since Friar Lawrence is worried that if it is not, something terrible ("sorrow") might happen in the future ("after-hours").
This line, therefore, serves as a reminder to the audience that Romeo and Juliet's relationship is fated to fail. Some terrible things do happen later on. In the next Act, for example, Romeo kills Tybalt and is banished from the city. Moreover, Lord Capulet arranges Juliet's marriage to Count Paris.
Friar Lawrence's comments, therefore, foreshadow these events. Moreover, they suggest that Romeo and Juliet's marriage does not have divine support, and as a result, the couple is prevented from making their marriage public and ending the feud between the Montagues and Capulets.