Is there a way to prevent iPad from going into Sleep mode when not in horizontal mode?
You can prevent iPad from automatically going into sleep mode, by setting Auto Lock to Never. But this setting cannot be made dependant on the current orientation of the device.
To set Auto Lock to Never, go to Settings App → Display & Brightness → Auto Lock and set it to Never. iPad can be send into Sleep mode anytime by manually pressing the physical Power button.