Allāh does not impose blame upon you for what is unintentional in your oaths, but He imposes blame upon you for what your hearts have earned. And Allāh is Forgiving and Forbearing.1
Translation: Saheeh International (English)
1 Overlooking many violations, postponing penalty and granting opportunities for repentance and rectification despite having the power to punish immediately.
Allah will not take you to account for those oaths that you swear unintentionally, such as if someone carelessly says, ‘No, by Allah!’ or ‘Yes, by Allah!’ For such oaths there is no need to make any compensation, nor any further consequences. However, He will take you to account for intentional oaths. Allah forgives and tolerates the sins of His servants and is not hasty in sending punishment.