This line is spoken by Portia when she has just told Shylock that he must be merciful towards Antonio with regard to his debt. She gives a long speech about the quality of mercy and how it blesses "him that gives and him that takes." Mercy is a quality associated with God, that is why it is referred to as a "divine" quality. Portia is saying that Shylock should be merciful, as God is merciful.
Portia is referencing the Bible in this speech, where the Bible teaches that God is merciful to sinners in his grace, because man does not deserve to be forgiven, but God forgives man anyway. Portia is calling upon Shylock to exhibit "divine" mercy to Antonio. There is irony in this speech because Shylock is a Jew and the characters in the play do not believe him capable of exhibiting Christian values.