I've added in a spoiler warning to your title for good measure as some of the details shared may reference future episodes.
As far as we can tell about Eric, the pills in the motel room are because of his ongoing medical condition from the aftermath of his shooting in season 5. We learned that he was having some problems with memory and certain tasks when he returned to work and in season 6 ('Bang Bang, Your Debt') it was mentioned that his brain was creating new pathways around the bullet fragment still in his head, which was causing him to hallucinate. After taking Horatio's advice, Eric started seeing a physician so we can probably surmise that the pills were prescribed by the doctor for that reason.
As for Ryan, we'll learn what the child's relation is to him in a future episode but I'll put some details into a spoiler code for you.
According to the spoilers, the child belongs to Ryan's Gamblers Anonymous sponser.
You may of course feel free to check out the Spoiler Lab for further information. That place is great for spoiler-related questions too.
Also, if you have any other non-spoiler related questions about the show, we have a nice and handy Episode Question Thread available to you as well at any time.