1. Question: Why doesn’t a marriage work if the man has in mind to divorce her soon after the marriage?
A. The Shulchan Aruch (Even HaEzer 2:10) says a person shouldn’t marry a woman with the thought to divorce her but if you inform her in the beginning that he is going to marry her for only some set amount of time, it is permitted.
B. The Chochmas Shlomo says that definitely when you inform her and she agrees, there is no prohibition in the matter. But even if you don’t inform her she fully agrees to marrying you right now and you fully agree to marry her right now so why is it forbidden to marry her without her knowing you are going to divorce her?
Answer: If she would know your intent it is assumed she would never agree to get married so really aren’t married and the relations you have with her is illicit. (See also the Taz.)