Yes they could, and many did serve in more than one company. While most stayed in the same outfit the entire time, it is not a rare occurance to find a man who went from one company or regiment to another. A cavalryman who lost his horse, and could not find a replacement, might easily end up in an infantry unit.
Here is a history of the 5th.
Your ancestor's records can be ordered by clicking the link at the top of the page. Proceeds help support this board.