I used iPad 2 a long time before getting iPhone 4S so all my music is on there. Now I cannot get the music from iPad to iPhone. How can I do it?
It depends on where you got the music from.
If you purchased it through iTunes on your iPad, then you can open iTunes on your phone, select the "More" tab, then tap "Purchased", then download the music onto your phone. "Purchased" is an iCloud feature. iCloud must be enabled, and configured correctly on all your iOS 5 or later devices. The navigation in getting to Purchase history has changed slightly, I believe, between iOS 5 and iOS 6, but the idea is the same.
If you ripped CDs, then transferred the content over to your iPad, you will have to use the computer that you ripped them to to sync the songs onto the iPhone.
If you downloaded them from somewhere such as Amazon on your computer before transferring them to your iPad, then you will need to connect your iPhone to your computer to sync those purchases.
One thing to note: you cannot transfer songs from your iPad to your computer with iTunes (unless it was purchased from iTunes, and the computer is authorized). So, in other words, if you no longer have the computer that had all your songs on it, and just your iPad does, you will want to look for third party software (maybe like this? I haven't used it, but just did a Google search) to transfer your media to your computer, then to your phone.
It depends on your country, more here. For me, it is not possible without OSx and iTunes.
If you have iPad and iPhone in less-supported country, you can make your life million-times easier if you buy some OSx -device such as laptop or old desktop. I really-really hate this feature but in order to use iOS -devices well, you should really consider investing in OSx.