a slave woman in islam can become her master's wife in some conditions but what if the master already have 4 wives and the condition for the slave to be wife arrived? will she become 5th wife? if she became wouln't it became against law?
No, a slave woman can not become the 5th 'wife' of her master. Your question has several misunderstandings:
Concubinage and Marriage are two different things. A concubine is not a wife. A concubine is a slave woman with whom sex is permissible because of ownership alone, without requiring any nikah contract.
And they who guard their private parts. Except from their wives or those their right hands possess (concubines), for indeed, they will not be blamed.
There is only a legal limit on the number of wives. There is no limit on the number of concubines. So for example a person can hypothetically have 4 wives and 10 concubines, and it would be legal. See Did scholars define a limitation of concubines a man could have?
A marriage contract with a concubine is actually not permissible for her owner. If the master wants to marry his concubine he would first have to free her.
لا يحتاج وطء السيد لأمته إلى إنشاء عقد زواج، ولو عقد النكاح لنفسه على مملوكته لم يصح النكاح
A Marriage contract is not required if a master wishes to have sexual relations with his female slave. And if he makes a marriage contract between himself and his female slave it is not valid.