To see my menu of all Muslim science posts, click https://muslimscience.blog/2016/08/10/mymenu/
detail from a 1700’s painting of a woman playing a setar at a banquet in Persia
Although the shape of a guitar is similar to the shape of the Arab oud, the sound of a guitar is more like that of the pre-Islamic Persian setar, because the oud did not have frets.
There were many stringed musical instruments in ancient Egypt, ancient Persia, and other pre-Muslim ancient lands.
The guitar probably descended from musical instruments brought by Muslims to Muslim Spain.
The guitar copied the shape of the lute, which copied it’s shape from the Arab oud. The use of frets was copied from the Persian setar, which Hindus call the sitar.
http://www.guyguitars.com/eng/handbook/BriefHistory.html says the Arab oud did not have frets but that the pre-Islamic Persian tar family of musical instruments did have frets.
[Tar is a word of Persian origin that means string. The setar had frets and 3 or more strings.]
The musical scale of Arab Muslim music was borrowed from the dastgah tonal system of pre-Islamic Persia.
Image by unknown 18th century Persian artist, via Wiikimedia Commons.