People use to say if this (condition) happen than I will give certain amount of money to poor, or I will fast for, for example 10 days. I want to know is it okay? Promising GOD that please do this (condition) and I will give money to poor with your will, or I will give food to 10 hungry people, or I will fast for 10 days. Please give answer with reference.
This is called Nazr and is an Islamic practice and is mentioned in many Quran verses and Hadiths. This is a contract with God. But Nazr has the related Islamic rules that should be fulfilled.
And whatever you spend of expenditures or make of vows - indeed, Allah knows of it. And for the wrongdoers there are no helpers. http://tanzil.net/#2:270
[Mention, O Muhammad], when the wife of 'Imran said, "My Lord, indeed I have pledged to You what is in my womb, consecrated [for Your service], so accept this from me. Indeed, You are the Hearing, the Knowing." http://tanzil.net/#3:35
So eat and drink and be contented. And if you see from among humanity anyone, say, 'Indeed, I have vowed to the Most Merciful abstention, so I will not speak today to [any] man.' " http://tanzil.net/#19:26
This is definition of Nazr by Ayatollah Sistani:
Vow means making it obligatory upon oneself to do some good act, or to refrain from doing an act which it is better not to do, for the sake of, or for the pleasure of Allah.
References and more study: