Note, first, that we say married to, not with. Married with in the sense "joined in marriage" is occasionally found in older English, but is no longer common
"I have been married to her for three years" implies that you married her three years ago and are still married to her.
"I was married to her for three years" implies that you were married to her for a three-year timespan in the past but are no longer married to her.
"I married her for three years" is not idiomatic English. Transitive marry, with your partner as Direct Object, ordinarily designates the act of entering the married state, not the state of 'being married'; that's an "achievement" which cannot take a timespan temporal. It might mean "I married her with the intention that the marriage should last three years", but that meaning is very unlikely; such term-limited contracts are not to the best of my knowledge recognized in the law of any English-speaking country