They likely learned about God by listening to faithful older ones, from receiving divine revelations, or from reading reliable ancient documents.
(‏ يو ٨ :‏ ٥٦‏ )‏ وَصَحَّ ٱلْأَمْرُ نَفْسُهُ فِي سَارَةَ وَإِسْحَاقَ وَيَعْقُوبَ وَغَيْرِهِمْ .‏