Early stages of proto-Indo-European (PIE) didn't have feminine gender. This is attested in Hittite, the oldest recorded IE language; it had only masculine and neuter genders, divided basically between animate and inanimate objects. For most noun classes the PIE endings can be reconstructed as follows:
Animate Inanimate Subject *-s *-0 Object *-m *-0
For animate nouns, *-s indicated the source of action, *-m the thing acted upon; the zero ending indicates no syntactic role. The basic idea is that only living things can act upon other things, so only animate nouns could take the *-s.
Such a system is characteristic of active/stative languages. Other features of PIE fit in with this observation; for instance, in PIE objects like fire and water which are inanimate but move seemingly of their own will have two separate names. In many languages with an active-stative distinction there are such pairs of words. As this distinction was lost in IE, different branches retained just one of the words: e.g. English water, Greek hydor, Hittite watarform one group (from PIE *wed-), while Latin aqua is from PIE *akwa:-.
The animate nouns are the historical source for the masculine gender, and the inanimate nouns for the neuter. This is why in all the classic IE languages the neuter nominative and accusative have identical forms, and the only basic difference between masculine and neuter nouns is in the accusative.
Earlier historical linguists cheerfully reconstructed eight cases for PIE, on the model of Sanskrit; but the IE languages with many cases are now considered to be innovative, not conservative. The other cases developed from postpositions or derivational suffixes. Luwian, a sister language of Hittite, for instance, has no genitive, but has an adjective-forming suffix -assi, as in harmah-assi-s 'of the head'. (This is an adjective, not a genitive, because it can be declined.) Genitives in other languages often seem to be developments of cognates to this suffix.
PIE didn't bother much with specifying plurals, but when it did, it added an *-s or other endings. The neuter plural in all IE languages is not descended from this, however-- active/stative languages typically don't mark plurals for inanimate nouns-- but is instead a collective noun, treated grammatically as a singular. This collective noun ended in *-a in the nominative and accusative, and eventually it developed into the feminine, which in all the old IE languages has the same form in the nominative singular as does the neuter plural nominative- accusative. It is also why the Greek neuter plural took a singular verb.
The reason it is called the feminine, of course, is that nouns indicating females fell in this gender most of the time. This is puzzling, and probably we must accept it as a fact whose explanation can't be recovered from the depths of time.