The iPhone 3GS only supports up to iOS 6.1.6, you can't update to a higher version.
If you want to download previous versions of an app then follow the instructions in Niel's reply above. Not all developers support the downloading of older versions, if the app is free then you can try downloading the current version on your computer's iTunes and seeing if you can download an older version in the Purchased tab in the App Store app on your phone ; if the app is paid-for try contacting the developer first and ask them if it will work (with iOS 6.1.6), don't buy an app and then find that you can't use it.