Temporary marriage (mut`ah marriage) is a marriage for convenience or sexual gratification for a specified period of time. It should be clear that temporary marriage is not permissible in Islam. Marriage can only be contracted with the intention of forging a permanent union. We are not allowed to resort to marriage simply for the purpose of sexual gratification for a certain period of time.
So we are not allowed to embark on marriage while you have the intention of terminating the marriage.
However, if one got married without having this intention and then he decided to terminate it, then the issue will be different.