All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
You did not clarify to us whether your relationship with that first man was based upon marriage or that it was an illegal relationship.
If you were not his wife, you are obliged to repent to Allaah for what you did; for the conditions of repentance, please refer to Fataawa 86527 and 87903.
If your daughter was from this illegal relationship, so she should not be traced back to that man and he has nothing to do with her in principle and it is not permissible for her to contact him especially that he is a non-Muslim. Rather, she should be traced back to you and you are obliged to nurture her; for more benefit, please refer to Fatwa 84788.
However, if your relationship between you and him was based on marriage, then there are two probabilities:
1- You married him while you were a non-Muslim and then you became a Muslim, and you gave birth to this daughter from that marriage. In this case, she is his daughter and she is permitted to keep ties with him if she does not fear any harm from him.
2- You married him while you are a Muslim. In this case the marriage is void because it is not religiously permissible for a Muslim woman to marry a non-Muslim man. In this case, the daughter should be traced back to him if he believed that that marriage was valid.
As regards what you mentioned in connection with your second husband, then he is mistreating you and he is wrong for reproaching you in front of your daughter and also for taunting your daughter about the color of her skin. Therefore, we advise you to be patient with him and advise him and remind him of Allaah in a soft and gentle manner. You should also remind him that what he did contradicts Allaah’s Order to the spouses to be kind to each other, as Allaah Says (what means): {And live with them in kindness.}[Quran 4:19]
What he did also contradicts the saying of the Prophet which reads: “The best amongst yourselves, are the best to their wives, and I am the best to my wives.” [At-Tirmithi and Ibn Maajah]
Hence, you should clarify to him that Islam does not approve of the discrimination because of sex, color and so forth, and that Allaah Says (what means): {Indeed, the most noble of you in the sight of Allaah is the most righteous of you.}[Quran 49:13]
If your husband is religious, then it is hoped that he will benefit from the advice. In this case, you may make use of what could benefit him, like listening to a Islamic lectures and so forth, and we also advise you, dear sister, to avoid doing what angers as much as possible.
Nevertheless, if he persists on that condition and you are harmed by staying with him, then you have the right to ask for divorce because of harm. However, you should not hasten to do this unless you make sure whether it is better for you to separate from him or to stay with him while being patient with him and continuing advising him.
Allaah Knows best.