There are a number of hadeeths which forbid rolling up the garment when praying.
Al-Bukhaari (812) and Muslim (490) narrated from Ibn ‘Abbaas (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) said: “I have been commanded to prostrate on seven bones: the forehead – and he pointed to his nose – the hands, the feet and the ends of the feet (i.e., toes), and not to tuck up my garment or hair.”
Tucking up the garment or hair means gathering it together to prevent it falling on the floor when one prostrates.
The scholars are unanimously agreed that it is not allowed to pray with the garment, sleeves and so on rolled up. … All of that is not allowed according to scholarly consensus; it is makrooh in the same that it is discouraged, so if a person prays like that he has done something wrong but his prayer is still valid. Abu Ja‘far Muhammad ibn Jareer at-Tabari quoted as evidence scholarly consensus. Ibn al-Mundhir narrated that the one who does that should repeat his prayer, and he narrated this view from al-Hasan al-Basri. End quote.
It says in Tuhfat al-Minhaaj, 2/161-162:
It is makrooh for the one who is praying to tuck up his hair by putting it together or putting it under his headgear, or to tuck up his garment, such as rolling up his sleeve or hem. End quote.
Based on that, tucking or rolling the pants up is makrooh when praying.
There are ahaadeeth which forbid letting the garment hang down or come lower than the ankles (isbaal).
Al-Bukhaari (5787) narrated from Abu Hurayrah (may Allah be pleased with him) that the Prophet (blessings and peace of Allah be upon him) said: “Whatever of the izaar comes lower than the ankles is in the Fire.”
Abu Dawood (4084) narrated from Abu Juray Jaabir ibn Sulaym (may Allah be pleased with him) that the Prophet (blessings and peace of Allah be upon him) said: “Beware of letting the garment come below the ankles, for that is conceit and Allaah does not like conceit.”
Classed as saheeh by al-Albaani in Saheeh Abi Dawood
So it is not permissible for a man to make his garment so long that it comes below the ankles. If he insists on letting it come below the ankles and wants to pray wearing these pants, then if he leaves them as they are he will be praying with his garment coming below the ankles, and if he rolls them up to come above the ankles, he will be praying with his garment tucked up. In this case we have a conflict between two prohibitions: the prohibition on letting the garment come below the ankle and the prohibition on rolling up the garment when praying. There is no doubt that the ruling on letting the garment come below the ankle is more stringent, because that is a major sin. As for rolling up the garment when praying, it is makrooh (disliked). If there is a conflict then precedence must be given to that which is more important, which is avoiding letting the garment come below the ankle. In that case he should roll up his garment until it comes above the ankle.
Shaykh ‘Abd ar-Rahmaan as-Suhaym was asked:
I tuck up my pants when praying so that I will not be letting them come below the ankles, but the Prophet (blessings and peace of Allah be upon him) forbade tucking up the garment when praying. Does this apply to tucking up the pants? What is the ruling on that?
If the pants or trousers come below the ankle, then they must be lifted up, in prayer or otherwise. In fact it is not permissible for them to touch the ankle because the Prophet (blessings and peace of Allah be upon him) said: “The izaar (lower garment) should come to mid-calf, but if you insist it may come lower, and if you insist it may come to the bottom of the calf, but it should not touch the ankles.”
Narrated by Imam Ahmad and an-Nasaa’i.
Tucking up the pants does not come under this prohibition because lifting the izaar away from the ankles is a shar‘i requirement; in fact it is obligatory, whereas the prohibition on tucking up the garment or the hair signifies that it is makrooh (disliked).
With regard to a woman praying in rolled up pants, women are forbidden to pray wearing pants whether they are rolled up or otherwise.
If she goes against that and prays wearing pants, the prayer is valid in and of itself.
An-Nawawi (may Allah have mercy on him) said in al-Majmoo‘ (3/176): If it covers the colour (of the skin) but shows the shape of the body such as the knee and buttock, and the like, then the prayer is valid because the condition of covering the body was fulfilled. ad-Daarimi and the author of al-Bayaan narrated a view that it is not valid if it shows the shape, but this is an obvious mistake. End quote.
For more information please see the answer to question no. 46529
If a woman prays wearing pants, she should not roll them up because there is no need for that, as what she is required to do is to cover the tops of her feet when praying, and because the prohibition on making the garment longer then the ankles applies only to men and does not include women.
And Allah knows best.