Yes, two countries who fought can for sure become allies in the future. We have fought England, and now we are allies. We have fought Mexico, and now we are allies. The countries who fight usually end up being allies after the war, and after they settle their problems with each other.
Yes, countries that have fought wars against each other can become allies in the future, just as allies can become foes. The United States and Britain used to be enemies, and now they are very strong allies. The United States fought Germany in World War II, but now they are allies. It just depends on the country's interests at the time.
Countries that have fought wars with each other often become allies. There are many examples of this. The United States' oldest enemy was the United Kingdom, today one of it's greatest allies. The US and Germany are also considered allies, despite having fought two brutal wars against each other. Japan is regularly considered one of America's greatest allies in Asia, despite the fact that Japan sneak attacked the US and the US dropped two nuclear bombs on Japan. Thus it is certainly possible.
I think that countries can forgive their rocky past relationships and start anew with fresh friendships. Sometimes it may be difficult for a country to reconnect with a different country it was fighting with previously, but I think that it can be done with hard work and compromise. An example of a country that had done this was the US and Britain, since they were enemies back in the 1700's or so and now they are basically allies in recent times.
It is possible for countries that have fought against each other in the past to become allies in the future. There are countless examples of such situations in history. For example, the United States is today strong allies with Japan, even though they fought a brutal war against each other in the last century.