It is not clear what you want. Are you talking about dynamic simulation? or are you trying to constrain deformation in a static analysis? In static analysis (whether linear or nonlinear) Ansys allows using "coupling" degrees of freedom (using command CP, etc) that is to make some selected nodes "move" together according to some linear equation that you could define. Also, you could issue displacement load ( D) for the nodes you want in the direction you want through various steps and by imposing some relation between these displacements..etc. It depends on what you precisely want to do.
What you are describing is nonlinear behavior, better be modeled as a kind of contact problem. My choice would be either the use of contact elements, or the use of nonlinear springs attached to their nodes (e.g. look at COMBIN37, or Combin39 elements in ansys).
For Combin37 element you can put a "control" based on a value of a degree of freedom that this element would represent. For instance if, say, displacement UX is "negative" then activate stiffness, if displacement is positive, then switch the element off. For COMBIN39 you can define a nonlinear spring with very large stiffness in compression and nearly zero stiffness in tension).
Also, simpler than above, you can look at Contact element CONTAC12, which can act like a gap-surface combination, i.e. a gap with a surface.
You would need to carefully read about these elements. There are also useful examples in the ansys manual about these.