Does spanking a child teach them that it's ok for another person to touch them against their will? The debate over whether spanking is an appropriate punishment largely revolves around proponents saying that it creates a more "disciplined" person and opponents saying that it traumatizes the child or makes them grow up violent.

One thing that, as far as I know, has been overlooked is the issue of how it affects a person's sense of personal physical sovereignty. Can a child really compartmentalize spanking such that they can believe "It is acceptable for my parent to spank me as long as a child, but nobody else, and not when I am an adult."? It doesn't seem likely to me. It seems that, if a child is conditioned to believe that spanking is a normal and acceptable thing, it isn't a stretch to believe that other entities, such as the government, have potential suzerainty over the individual.

Given that any rational person should want their children to believe that nobody but nobody has the right to touch them against their will, for any reason, would it not make sense that spanking is detrimental to an individual's psyche?
Short answer

It depends on the definition you are referring to on "touch them against their will?"

If you are referring to violent touching in the form of physical punishment/restraining etc. then it is proven by the accounts given by may people who advocate physical punishment.

If you are talking about sexual touching, spanking does not necessarily teach them that it's ok for another person to touch them against their will, but it can lead to someone touching them against their will.

Long Answer

Preable before answering the question

To cover the point raised by @user13275 in the comments, physical punishment (also known as corporal punishment) has been defined as


  the use of physical force with the intention of causing a child to experience bodily pain or discomfort so as to correct or punish the child’s behavior” (Gershoff, 2008, p. 9)


This includes: spanking, hitting, pinching, squeezing, paddling, whipping, ”whupping,” swatting, smacking, slapping, washing a child’s mouth with soap, making a child kneel on painful objects, and forcing a child to stand or sit in painful positions for long periods of time. (Holinger, 2015)

In a 2012 editorial piece within the Canadian Medical Association Journal, John Fletcher, MB BChir MPH, Editor-in-Chief says


  Is spanking wrong? Clearly, hitting anyone in anger or when losing an argument is bad behaviour. To do this to children sets a bad example and may only teach them that violence is a means to getting their own way. But what about a slap as the ultimate sanction and a means of enforcing boundaries and discipline? It’s an obvious question and one in which parents will be interested. Are those who use physical punishment bad parents?
  
  If they are, then they are in the company of roughly 90% of my parents’ generation, including 70% of family doctors and 60% of pediatricians, who thought spanking acceptable in some circumstances. The proportion of parents who spank toddlers now is still high but closer to 50%.


He also states in the editorial


  So heated is this debate, and so long-running, that the question of whether spanking is morally “right or wrong” is probably intractable. A more promising line of enquiry, however, is whether the physical punishment of children is effective.


Whilst there are opponents to the idea that physical punishment is wrong, Birbalsingh (2012) for example provides an argument for how physical punishment provides an ultimate form of discipline, a key piece or research on the effects of physical punishment on the child, which the editorial points to, is Durrant and Ensom (2012) which was also published in the Canadian Medical Association Journal.  This article looks at lessons learnt from 20 years of research.


  Today, research showing the risks associated with physical punishment is robust, the convention has been integrated into the legal and policy frameworks of many nations, and 31 countries have enacted prohibitions against the physical punishment of children. These three forces — research, the convention and law reform — have altered the landscape of physical punishment.
  
  The growing weight of evidence and the recognition of children’s rights have brought us to a historical point. Physicians familiar with the research can now confidently encourage parents to adopt constructive approaches to discipline and can comfortably use their unique influence to guide other aspects of children’s healthy development.


One of the pieces of research that this article pointed to shows that spanking leads to escalated levels of Antisocial Behaviour from children 6-9 years of age (Straus, et al. 1997)

In a treatment study, Marion Forgatch showed that a reduction in harsh discipline used by parents of boys at risk for antisocial behaviour was followed by significant reductions in their children’s aggression. (Forgatch, 1991)

In answer to your question


  Does spanking a child teach them that it's ok for another person to touch them against their will?


If you are referring to sexual touch, 

The way physical punishment is used will determine whether the child's autonomy is challenged or not.


  Controlling parents are motivated by the Authoritarian Personality Syndrome and therefore are compelled, by fear of loss of control, to restrict the child's self-directed, autonomomous efforts.  While parents motivated by the Authoritarian Personality Syndrome are controlling, it does not follow that the converse is true.  Some subgroups of controlling parents permit high autonomy in many areas of the child's life.  Hoffman, et al. (1960) described a subgroup of parents who were perceived by their children as both coercive and permissive of high autonomy. (Baumrind, 1966)


This indicates that a parent can use physical punishment but still provide the child some autonomy over their personal rights.  The other personal rights taken away contravene articles 19, 28(2) and 37 of the UN Convention on the Rights of the Child (UNCRC) - which is legally binding in international law and signed by 140 signatories involving 196 UN States.

However, some may use physical punishment in order to take the child's autonomy away completely or deminish the child's feelings of self-worth, which can lead the child to look for love and affection elsewhere.

Spanking does not necessarily teach them that it's ok for another person to touch them against their will, but it can lead to someone touching them against their will.  Although with sexual touching, that there are other factors which can play a role including whether the concept of "good touch/bad touch" or the pants/swimsuit/underwear rule has been taught to them, but again, that does not necessarily completely prevent it when the child is really desperate for attention, love and affection.

Anthony (2008) on page 253, says that you can have the following initial belief (iB)


  "I absolutely must be loved by so-and-so, and if not it's awful and I am and inadequate person because he/she does not love me!"
  
  When you question and challenge this iB you often can come up with an Effective New Philosophy that is accurate but still in the infancy stages and therefore weak: "I guess that there is no reason why so-and-so must love me, because there are other people who will love me when so-and-so does not.  I can therefore be reasonably happy without his/her love."


From experience from talking to and supporting abused people, in the bid to find love elsewhere it can lead a child (or adult in later life) to get into an abusive relationship with someone in the belief that that person is doing the things they do (including inappropriate touching etc.) because that person loves them.

References

Anthony, R. 2008. Ending the Epidemic of Child Abuse. Raleigh, NC:Lulu.com
Paperback at Amazon.com
PDF eBook at Lulu.com at a much cheaper price

Baumrind, D. 1966. Effects of Authoritative Parental Control on Child Behavior Child Development 37(4): pp 887—907
DOI: 10.2307/1126611

Durrant, J. and Ensom, R. 2012. Physical punishment of children: lessons from 20 years of research. Canadian Medical Association Journal 184(12): pp 1373–1377
DOI: 10.1503/cmaj.101314 PCMCID: PMC3447048

Forgatch M.S. 1991. The clinical science vortex: a developing theory of antisocial behaviour. In: Pepler DJ, Rubin KH, editors. The development and treatment of childhood aggression. Hillsdale, New Jersey: Erlbaum; p. 291–315

Hoffman, L., et al. 1960. Parental coerciveness, child autonomy and child's role at school. Sociometry 23(1): pp 15—22
DOI: 10.2307/2786134

Gershoff ET (2002). Corporal punishment by parents and associated child behaviors and experiences: A meta-analytic and theoretical review. Psychological Bulletin 128(4): pp 539-579.
DOI: 10.1037/0033-2909.128.4.539

Holinger, P.C. 2015. Physical Punishment—and Violence Psychology Today [Online]
https://www.psychologytoday.com/blog/great-kids-great-parents/201508/physical-punishment-and-violence

Straus M.A., et al. 1997. Spanking by parents and subsequent antisocial behavior of children. Archives of Pediatrics and Adolescent Medicine Journal 151(8): pp 761—767
DOI: 10.1001/archpedi.1997.02170450011002  PMID: 9265876