Connecting an ac-dc adapter and a battery in series
The basic answer is YES. But be aware. The 24 V obtained this way supplies energy from the wall adapter and the battery into your application. This causes the battery to discharge and the output voltage of the battery goes slowly down and so does the total voltage.

It therefore depends on your application if this option is feasable.

When discharging a battery you have to watch also the maximum discharge rate.
Example you have a battery of 12V 2 Ah - 1C and a wall adapter of 12 V 2A then you can safely connect an application that takes 24 V 2A. If however the battery specification indicates 12V 2Ah - 0,5C with the same wall adapter then you can only connect an application that takes 24 V 1A. otherwise the battery gets damaged.

In general it is like this. The weakest part in the supply chain determines the amount of current can be taken and fed to the application.