For an alternative jurisdiction (Australia) see https://aifs.gov.au/cfca/publications/corporal-punishment-key-issues. I quote:
In most states and territories, corporal punishment by a parent or carer is lawful provided that it is carried out for the purpose of correction, control or discipline, and that it is "reasonable" having regard to:
- the age of the child;
- the method of punishment;
- the child's capacity for reasoning (i.e., whether the child is able to comprehend correction/discipline); and
- the harm caused to the child (Bourke, 1981).
Corporal punishment by teacher's in schools was progressively banned in each state and territory starting in 1985 (Victoria) and being completed in 2009 (Northern Territory). In some jurisdictions there was a difference in the time of banning between state (public) and private schools; an interesting anomaly is that corporal punishment is still legal in Northern Territory state schools but is prohibited by departmental policies - a teacher who used it could be sacked but not prosecuted.
When did beating your child become illegal?
It isn't if "beating" means "reasonable" corporal punishment.
Or was it always and now it is just more strictly enforced?
Striking a child (or anyone) when doing so is not "reasonable" has always been illegal. Interpretation of "reasonable" has changed over time. Also, domestic violence of any kind has tended to be an area of poor enforcement historically.
Is spanking a child technically legal?
Is this illegal?
If the punishment was reasonable, no.