You have a few options here. Which of them you use will depend on exactly how much you're willing to spend, and what you want to get from the recording.
Your first option is to find a small mixing console, run your inputs into this, then run from the output of your mix console into whatever your recording device will be. This is known as recording to mono or recording to 2-track, depending on whether the end result is a single channel or a pair of channels mixed for the left and right speaker. As to the backing track, most mixers, even small ones, have some sort of aux send which you can use to send the signal to head phones for the players.
The other option is to buy a small audio interface, get a cheap Digital Audio Workstation (Reaper if Windows, you should already have GarageBand if you're on Mac). From there, run the instruments into the inputs of the interface, adjust the DAW to recognize the inputs and create a couple tracks for the instruments. To play the backing track, import the file to the session and make sure the DAW is monitoring existing tracks, then record without arming the backing track. The beauty of this approach is that you can edit the individual tracks, or rerecord one or the other of the musicians if you have a good take for one but not the other.
Things you will need either way:
1/8" (3.5mm) to either 1/4" or RCA adaptors - Most console and interfaces don't use small TRS jacks, so you'll need some way to get this up to whatever input your gear uses.
Something to bring your guitar up to line level - This can be a guitar amp, a direct box, or something along the lines of Line 6 Pod. Note that if your guitar amp does not have a line out, you may need to record it with microphones, which adds another layer of complexity onto the question.
Headphone box or splitter - When using smaller, cheaper mixers or interfaces, one of the first limit you will run in to is your output channels. You will need to listen to the mix while recording, and the musicians will need some sort of mix as well. Letting your musicians both use the same headphone line will help overcome this, and can allow them to independently control their own volume as well.
Assorted cables, headphones, etc... - Self explanitory