Outer ear infections might be contagious only if you put your finger in your ear and you put your finger into someone else's ear. It would have to be direct contact.
Middle ear infections are not contagious, but the underlying condition that causes the middle ear infection is contagious. That is to say, that in children, most middle ear infections are due to an upper respiratory tract infection, either a cold or a sinus infection or bronchitis; and that is highly contagious.
Inner ear infections, which are viral, are not contagious.