I’m kinda confused about using pronouns in dative and accusative. For example:
Hat Max’ Freundin den Ring schon? - Ja er hat __ schon gegeben.
Which pronoun fits this case is it ihm because we are talking about the ring which is masculine?
As mentioned in the comments to the question, geben requires two objects. One accusative object (who or what is given?) and one dative object (whom was it given to?).
In many cases it doesn’t matter in which order you place the two. In your example:
Er hat ihr ihn schon gegeben (He gave her it [the ring] already)
Er hat ihn ihr schon gegeben (He gave it [the ring] to her already)
It’s pretty clear in this context which is the object that was given and which the object that received something, especially because one object here is male and one is female.
Another example of two male objects would be this:
Hat Max die Schlüssel schon? Ja, er [Peter] hat ihn [wen? den Schlüssel (acc.)] ihm [wem? Max (dat.)] schon gegeben.
Hat Max die Schlüssel schon? Ja, er [Peter] hat ihm [wem? Max (dat.)] ihn [wen? den Schlüssel (acc.)] schon gegeben.
In this case you need to look closer at which is the accusative object and which is the dative object.