Likely from ragged + time, in reference to its heavy use of syncopation, or from rag, an American dialectal term for a dance ball.
Practice speaking and memorizing "ragtime" and many other words and sentences in English.