Quick cooling on earth’s surface is the condition that you would expect a glassy extrusive rock like obsidian to form.
To add, an obsidian is a naturally occurring volcanic glass formed as an extrusive igneous rock. It is made when felsic lava emitted from a volcano cools swiftly with minimal crystal growth.