In Shakespeare's Romeo and Juliet, the quote given is spoken by Mercutio. The conversation occurs between Romeo and Mercutio before they attend the Capulet's masquerade party, and before Romeo first meets Juliet. At this point, he is still lamenting his unrequited (unreturned) love by Rosalind, who has promised herself to a convent.
Romeo has asked Mercutio how to handle love when it hurts. He asks if love is tender: if so, it seems too rough and aggressive, sharp like a thorn.
Is love a tender thing? It is too rough,
Too rude, too boist'rous, and it pricks like thorn. (I.iv.25-26)
Mercutio, ever to the point, responds that if love is rough with you, be rough right back. If it pricks you like a thorn—causing you pain— stick it back; if you do this, eventually love will falter or collapse under your aggressive response.
If love be rough with you, be rough with love. Prick love for pricking, and you beat love down. (I.iv.27-28)
Although this may seem to Mercutio like good advice, it is obvious that Romeo is not such a strong person with love—at least not at this point in his life. He has spent a great deal of time romanticizing and sighing over his love of Rosalind, acting like a victim. It is not until he meets and falls in love with Juliet that the immature Romeo "turns a corner," maturing to the point that he will aggressively do all that he can, not to beat love down, but to win Juliet's love for himself.