A variation of Mr.Wizard, a little faster:
Clear["`*"];
getPrimitiveTriple = Compile[{{n, _Integer}},
Module[{bag = Internal`Bag[Most@{0}]},
Do[
If[GCD[i, j] == 1,
Internal`StuffBag[bag, Sort@{j^2 - i^2, 2 i j, i^2 + j^2}, 1]],
{i, (Sqrt[2 n - 1] - 1)/2}, {j, i + 1, Sqrt[n - i^2], 2}];
#[[Ordering[#[[All, 3]]]]] &@Partition[Internal`BagPart[bag, All], 3]
]
];
getAllTriple[n_Integer] := SortBy[Join @@ (Outer[Times, Range[n/Max@#], #] & /@
getPrimitiveTriple[n]), Last];
getAllTriple[50]
{{3, 4, 5}, {6, 8, 10}, {5, 12, 13}, {9, 12, 15}, {8, 15, 17}, {12, 16, 20}, {7, 24, 25}, {15, 20, 25}, {10, 24, 26}, {20, 21, 29}, {18, 24, 30}, {16, 30, 34}, {21, 28, 35}, {12, 35, 37}, {15, 36, 39}, {24, 32, 40}, {9, 40, 41}, {27, 36, 45}, {14, 48, 50}, {30, 40, 50}}
getAllTriple[10^6] // Length // AbsoluteTiming
{1.08712,1980642}