HIV is a really fragile virus - it only survives at levels where transmission is possible for around 10 minutes after exposure to the air. So no, you're highly unlikely to contract HIV from a baggie of meth.
Hepatitis B and C are much more robust and have been found to survive up to four weeks on a surface in lab conditions. So if either of these viruses were to somehow be in the baggie (say if someone with hep B or C had drawn up out of the same bag with a used needle, or handled the content inside with blood on their fingers) it would be possible for transmission to take place. Both hep B and hep C can be transmitted in drops of blood that are too small to see.
The real infection risk with injecting meth out of a bag isn't viruses, though, it's fungus and bacteria that can cause local infections at the injection site and lead to complications with your heart and lungs. The best way to avoid this is to use a wheel filter (also called a micron filter) that you can get from NSPs. Wheel filters will block bacteria and fungus, but not viruses.