It is true that Shylock has been treated with contempt, especially by Antonio. As Shylock himself mentions in Act 1, scene 3:
...He hates our sacred nation, and he rails,
Even there where merchants most do congregate,
On me, my bargains and my well-won thrift,
Which he calls interest.
Antonio's prejudice is also obvious, for he later criticizes Shylock's reference to scripture in his attempt to prove that charging interest is not immoral, as Antonio believes. Antonio tells Bassanio in this instance:
Mark you this, Bassanio,
The devil can cite Scripture for his purpose.
An evil soul producing holy witness
Is like a villain with a smiling cheek,
A goodly apple rotten at the heart:
O, what a goodly outside falsehood hath!
Antonio has offered to stand surety for a loan from Shylock to Bassanio, and when he asks the moneylender if he will consider providing the loan, Shylock replies:
Signior Antonio, many a time and oft
In the Rialto you have rated me
About my moneys and my usances:...
...You call me misbeliever, cut-throat dog,
And spit upon my Jewish gaberdine,
And all for use of that which is mine own...
...You, that did void your rheum upon my beard
And foot me as you spurn a stranger cur
Over your threshold:
In this extract Shylock mentions examples of Antonio's abuse. He has publicly criticized him for his moneylending practices, specifically with regard to the fact that he charges interest. He has also called him a heathen, and compared him to a merciless dog and spat on his cloak. He has also spat in his face and kicked him as he would a vagrant dog that crossed his door. Shylock sarcastically calls these "courtesies" and rhetorically asks if he should then lend Antonio money for such ill treatment.
Antonio's response to these accusations is unapologetic:
I am as like to call thee so again,
To spit on thee again, to spurn thee too.
He clearly does not have any amity for Shylock and states that he will do the same if the occasion should present itself. Antonio's attitude towards Shylock is typical of the ill-feeling that Venetians bore towards foreigners at the time. They could not accept the impositions sprung upon them by outsiders and they resented their presence, their customs and their religion. This sentiment was returned by the foreigners and Shylock expresses his loathing for Antonio.
I hate him for he is a Christian,...
...If I can catch him once upon the hip,
I will feed fat the ancient grudge I bear him.
Shylock evidently wants to take revenge on Antonio, for he bears him a very old grudge. He wishes to catch Antonio at a disadvantage to do so. It is this shared malice between the two which almost results in tragedy. This is, however, avoided due to Portia's timely intervention during Antonio's trial, where Shylock has asked for judgement against Antonio for forfeiting on the loan which he had granted him. The principal condition of the bond was that Shylock could claim a pound of Antonio's flesh if he should forfeit.
Once Shylock has gotten Antonio at a disadvantage, he stubbornly refuses to accede to any other arrangement. He is appealed to by different parties to reconsider and be merciful, but refuses to give even an inch. As a result, Shylock becomes a victim of his own malice. The court, through Portia's advice, orders him to give up half his property to the state and donate the other half to Antonio. The judgement is based on the fact that he, a foreigner, wanted to intentionally harm a Venetian citizen. Because of this, the duke can, furthermore, decide whether he should also forfeit his life.
At this point Antonio intervenes and in an act of what he believes is mercy, requests the court that it should set aside its original judgement and compel Shylock to donate half his wealth to his new son-in-law, Lorenzo, and will the other half to the married couple who will then be his heirs upon his death. Antonio also asks the court to compel Shylock to become a Christian.
This is seemingly the harshest punishment of all, since Shylock is a devout Jew and cannot tolerate Christians. It is a lifelong burden which he will have to bear and is also an indication of Antonio's vindictive nature. One may argue that Antonio has saved Shylock's life and half his property, that he has been merciful, but if one should weigh the two judgments against each other, it should be obvious that asking the deeply devout Jew to abandon his faith is probably the worst. That, however, is probably just a matter of opinion.