We construct the equation of state (EOS) for infinite nuclear matter at zero and finite temperatures with the variational method starting from the realistic nuclear Hamiltonian composed of the Argonne V18 two-body potential and the UIX three-body interaction (TNI). At zero temperature, we evaluate the expectation value of the two-body nuclear Hamiltonian using the Jastrow-type wave function in the two-body cluster approximation with two conditions: The extended Mayer's condition and the healing-distance condition. Then we take into account the TNI contribution which includes adjustable parameters whose values are determined so as to reproduces the empirical saturation data. The maximum mass of the neutron star with the present nuclear EOS is 2.2 M ⊙ . At finite temperatures, we employ a method by Schmidt and Pandharipande, to obtain the free energy for nuclear matter. The critical temperature is about 18 MeV. We also calculate the free energy for asymmetric nuclear matter.