Why do I have to unlock an iPad to charge it?
The 'unlock to charge' is a new security feature since iOS 11.4. If you charge from a device that asks to communicate over USB you have to opt in. 
Alternatively, just plug in to a 'dumb' charger or employ a USB data block dongle / condom to physically prevent “juice jacking”. If there's no potential data connection, there's no restriction on charging or prompt to unlock.

To elaborate a bit, this design prevents hardware USB devices read data from your device. Remember when the FBI wanted to get into some guy's phone &amp; tried to force Apple through the courts to 'let them in'? This is the current state of play in the hacker 'war'.

It can be disabled if you don't think you have any data on there worthy of government or black hat hacker intrusion.

Apple KB - Using USB accessories with iOS 11.4.1 and later

Settings > Face [Touch] ID &amp; Passcode > USB Accessories