What is difference between
Have you ever married?
Have you ever been married?
To marry is to get married, to enter the state of wedlock.
To be married is to be (for some time) in the state of wedlock.
So your questions mean "Have you ever entered the state of wedlock?" and "Have you ever lived in the state of wedlock?"
The first literally means "Did you ever perform the specific actions required to be considered a married person?"
The second literally means "Were you ever in the specific type of personal relation called 'marriage'?"
In practice, the two statements would often be two different ways to ask about previous marital status. That is, they would frequently have the same meaning.
But if the context was the process of getting married in a particular legal jurisdiction or in conformity with the dictates of a particular religion, then the question would be along the lines "have you ever married in the state of Florida?
Or if the context was the complexities of married life, then a sensible question to ask would be "have you ever been married."
To sum up, both formulations are logically indistinguishable because you cannot have been married unless you first married, and if you ever married, you certainly have been married. So in many contexts they are asking the same question. But in some contexts, one formulation stresses acts, and the other formulation stresses a relationship.