A townhouse is a 'style' of home. Examples of different styles are ranch/garden, split, etc.
A condo (or condominium association) is a form of ownership. This is where a group of property owners come together to maintain common elements of the property. This usually happens when walls are adjoining, although standalone single family homes may also form an association.
Therefore, a townhouse is usually part of a condo association, and a condo may or may not be a townhouse
Hope this helps, feel free to contact me anytime
Equity Capital Real Estate
(203) 280 3838