The sharia'a of those prophets was not the same as that of Prophet Mohammad. All prophets had been monotheists but having their own sharia'a which was provisional and not Universal like the present sharia'a of prophet Mohammad. Whatever was the status of Prophet Nuh's and Prophet Lot's wives was not in contradiction of their sharia'a. That is why they married them.